© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
Only in .NET stacks do we trust

✅ Can my Equals(IEnumerable<T>? x, IEnumerable<T>? y) be made much simpler?

You may have any tricks to simplify the following.
public bool Equals(IEnumerable<T>? x, IEnumerable<T>? y)
{
    if (x is null) return y is null;
    if (y is null) return false;
    return x.SequenceEqual(y);
}
public bool Equals(IEnumerable<T>? x, IEnumerable<T>? y)
{
    if (x is null) return y is null;
    if (y is null) return false;
    return x.SequenceEqual(y);
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Implementing IEnumerable<T>
C#CC# / help
3y ago
✅ My program can’t be run.
C#CC# / help
16mo ago
✅ What is IEnumerable<out T> ?
C#CC# / help
3y ago
IEnumerable<T> (or List<T>, or T[]) to IEnumerable (non-generic, ie. no type param)?
C#CC# / help
2y ago