Tutorial by Examples

Equals is declared in the Object class itself. public virtual bool Equals(Object obj); By default, Equals has the following behavior: If the instance is a reference type, then Equals will return true only if the references are the same. If the instance is a value type, then Equals will...
GetHashCode has major performance effects on Dictionary<> and HashTable. Good GetHashCode Methods should have an even distribution every integer should have a roughly equal chance of returning for a random instance if your method returns the same integer (e.g. the constant '999') for e...
For a class Person like: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } var person1 = new Person { Name = "Jon", Age = 20, Clothes = "some clothes" }; var person2 = new Person { Name ...
For given type Person: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } List<Person> persons = new List<Person> { new Person{ Name = "Jon", Age = 20, Clothes = "some clothes...

Page 1 of 1