比较两个类型ITWEET的阵列
我想比较两个类型itweet
的阵列,请注意,此类不是我的,并且似乎内部没有平等比较。
ITweet[] tweets = await GetLikes();
ITweet[] newTweets = await GetLikes();
if (!tweets.SequenceEqual(newTweets))
{
// Notice that this won't work
}
newTweets.Except(tweets); // This neither
我该如何比较它们?我想使用,除非我确实需要那些不同的发生。正确的方法是什么?
更新:我注意到itweet
实现iquabalable
,但由于某种原因equals
均无效。
I'd like to compare two arrays of type ITweet
notice that this class isn't mine, and seems it doesn't have Equality Comparer inside.
ITweet[] tweets = await GetLikes();
ITweet[] newTweets = await GetLikes();
if (!tweets.SequenceEqual(newTweets))
{
// Notice that this won't work
}
newTweets.Except(tweets); // This neither
How could I compare them? I'd like to use Except since I do need those different ocurrences. What'd be the correct approach?
Update: I noticed ITWeet
implements IEquatable
but for some reason Equals
don't work neither.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论