CSharp examples for System.Reflection:Constructor
Get Default Instance Of
using System.Reflection; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from w w w .ja v a 2 s. co m public class Main{ public static object GetDefaultInstanceOf(this Type instanceType) { if (instanceType.IsValueType) return Activator.CreateInstance(instanceType, true); else return null; } }