Table of contents Home page
using System; public class Program { public static void Main(string[] args) { Object v = new Object(); Console.WriteLine("v.toString() = \"{0}\"", v); Console.ReadKey(); } }
using System; class Program { static void Main() { string s1 = "Hello"; string s2 = "Hello"; string s3 = "Goodbye"; // Show that s1 and s2 refer to the same object. Console.WriteLine(Object.ReferenceEquals(s1, s2)); // Show that s1 and s3 refer to different objects. Console.WriteLine(Object.ReferenceEquals(s1, s3)); Console.ReadKey(); } }