No equality operators for IUser (and possibly others)
See original GitHub issueThis makes it impossible to use LINQ and other built-in methods for ensuring that objects are equal to each other. Will submit a pull request with this.
IReadOnlyCollection<IUser> usersReacted = await msg.GetReactionUsersAsync(emote.Name); // Returns list of 25 users (subset of everyone in guild)
IReadOnlyCollection<IUser> usersInGuild = sguser.Guild.Users; // Returns list of 50 users
IEnumerable<IUser> usersToRemove = usersInGuild.Except(usersReacted); // Should return everyone in the guild except those who reacted
usersToRemove
ends up being the same as usersInGuild
. I’ll try and find a less-painful solution than doing things manually.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Python Not Equal – Does Not Equal Operator Tutorial
The not equal operator is a relational or comparison operator that compares two or more values (operands). It returns either true or false ......
Read more >No == operator found while comparing structs in C++
In C++, struct s do not have a comparison operator generated by default. You need to write your own: bool operator==(const MyStruct1& lhs, ......
Read more >Equality operators - test if two objects are equal or not
In this article The == (equality) and != (inequality) operators check if their operands are equal or not. Value types are equal when...
Read more >Equality, Relational, and Conditional Operators
The equality and relational operators determine if one operand is greater than, less than, equal to, or not equal to another operand. The...
Read more >Comparison operators
6) Returns true if lhs is not equal to rhs, false otherwise. In all cases, for the built-in operators, lhs and rhs must...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
.Except()
(and just about every other LINQ method) has an overload that takes in anIEqualityComparer<T>
at which point you can just do something like this. No need to write your own methods.Should probably be closed now that comparers have been added.