Get a Type reference
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| C# Code Snippets |
| See also |
| edit |
This C# code snippet uses three different methods to obtain a Type reference to a given type—in this case type int.
Console.WriteLine (typeof (int)); Console.WriteLine (Type.GetType ("System.Int32")); Console.WriteLine (new int().GetType());
All three approaches output "System.Int32" for type int.