Category Results  

Equality Operator | Equals

Equals method is a generic method for any type. Equals operator provides user to compare two instances and returns true if they are equal, returns false if they are not equal. Most common mistake about Equals operator is that using it for objects without overriding it.  Because Equals method compares object by their hashcode. So when you compare two items which are different instances of a class, it will return false although they have some properties. Let’s take a look at the following example,

Read More
Convert Data Types

Convert string to int

Here is an example about converting string to int. Converting datatypes are easy but it is so dangerous too. Because when you try to convert a string which is not a valid of being a representation of an int, it will throws exception. So considering these criticals, using int.TryParse(input, out output) is safier.

Read More
Convert Data Types