Call GetType and ToString on object instance : Class Instance « Class « C# / CSharp Tutorial






using System;

public class Thing 
{
    public int i = 2;
    public int j = 3;
}
   
public class objectTypeApp
{
    public static void Main() 
    {
        object a;
        a = 1;
        Console.WriteLine(a);
        Console.WriteLine(a.ToString());
        Console.WriteLine(a.GetType());
        Console.WriteLine();
   
        Thing b = new Thing();
        Console.WriteLine(b);
        Console.WriteLine(b.ToString());
        Console.WriteLine(b.GetType());
    }
}








7.2.Class Instance
7.2.1.Invoke a method in a class
7.2.2.Instance Class Members
7.2.3.Try to change static value in different instance
7.2.4.public member method
7.2.5.Creating an array of objects.
7.2.6.Call GetType and ToString on object instance