When I was working on a project today, I had a List of objects where I needed to grab objects that had a distinct property value (i.e. where MyObject.MyID is distinct).
I discovered the Distinct() method on the List and I had never used it before so I wasn’t sure of the syntax. After further review, I learned you can use the IEqualityComparer interface to specify how to determine if the object is distinct.
I’ll just show you the code because I feel it’s self explanatory:
public class MyObjectMyIDComparer : IEqualityComparer
public bool Equals(MyObject x, MyObject y)
return x.MyID == y.MyID;
public int GetHashCode(MyObject obj)
Now you can call the Distinct() method and pass in the class:
List MyObjectDistinctMyIDList = MyObjectList.Distinct(new MyObjectMyIDComparer()).ToList();
What is the best programming language for web development?
If there was one “best” programming language, then everything else would be obsolete. The reality is that there are so many different programming languages because there is no “best” language for any situation.
Web development can vary from a few hundred to millions of dollars depending on what is needed. You may simply need some changes to something that already exists, or you'd like to build a large or complex application.
As web development evolved, it separated into logical specialization: front end web development and back end development. While back end development involves the server-side development, front end is the final rendering.
Full stack web development as a term evolved due to the separation of roles between front end and back end developers. A “full stack” developer is a developer that can work in both front end and back end technologies.