預設運算子
值型別(其中 T:struct)
內建的原始資料型別,例如 char,int 和 float,以及用 struct 或 enum 宣告的使用者定義型別。他們的預設值是 new T():
default(int)            // 0
default(DateTime)       // 0001-01-01 12:00:00 AM
default(char)           // '\0' This is the "null character", not a zero or a line break.
default(Guid)           // 00000000-0000-0000-0000-000000000000
default(MyStruct)       // new MyStruct()
// Note: default of an enum is 0, and not the first *key* in that enum
// so it could potentially fail the Enum.IsDefined test
default(MyEnum)         // (MyEnum)0
參考型別(其中 T:類)
任何 class,interface,陣列或委託型別。他們的預設值是 null:
default(object)         // null
default(string)         // null
default(MyClass)        // null
default(IDisposable)    // null
default(dynamic)        // null