In this website I read the following code which I think is wrong:
string s = "Geeks";
Type a1 = typeof(string);
Type a2 = s.GetType();
Console.WriteLine(a1 == a2);
//output: True
Now, please correct me if I am wrong because I am new in C#.
- "Geeks" is a string object.
- typeof(string) returns a Type object.
- s.GetType() returns a Type object.
- a1 and a2 are reference type variables of datatype Type.
So a1==a2 should be a referential comparison and should return false since there are two different Type objects.