Guest User

Untitled

a guest
Oct 16th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1.  // Create two equal but distinct strings
  2.         string a = new string(new char[] {'h', 'e', 'l', 'l', 'o'});
  3.         string b = new string(new char[] {'h', 'e', 'l', 'l', 'o'});
  4.        
  5.         Console.WriteLine (a==b);
  6.         Console.WriteLine (a.Equals(b));
  7.        
  8.         // Now let's see what happens with the same tests but
  9.         // with variables of type object
  10.         object c = a;
  11.         object d = b;
  12.        
  13.         Console.WriteLine (c==d);
  14.         Console.WriteLine (c.Equals(d));
Add Comment
Please, Sign In to add comment