object [] sNames = new object[3];
sNames[0]="Test1";
sNames[1]="Test2";
sNames[2]="Test3";
Code:
string [] sNames2 = new String[3];
sNames2[0]="Test1";
sNames2[1]="Test2";
sNames2[2]="Test3";
Now something you have to know having the above examples:
string s = "Test";
string t = string.Copy(s);
Console.WriteLine(s == t); // returns True
Console.WriteLine((object)s == (object)t); // returns False
The reason are that because the first comparison compares two expressions of type string, and the second comparison compares two expressions of type object.
-obislavu-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.