コード例 #1
0
 /// <summary>
 /// Creates a default instance of the type.
 /// </summary>
 /// <param name="t">Type extension reference.</param>
 /// <returns>System.Object.</returns>
 /// <remarks>
 /// If the type is a value type or primitive, it will return a type that is
 /// that primitive or value type initialized to zero.
 ///
 /// If the type is a complex type, and the type contains a default constructor
 /// it will return a default instance of that type. If the type does not have
 /// a default constructor, it will return null.
 /// </remarks>
 public static object CreateDefault(this Type t)
 {
     return(ConvertAny.DefaultByType(t));
 }