default keyword is mainly used while writing generic code.
In generic classes and methods, one issue that arises is how to assign a default value to a parameterized type T when you do not know if T will be a reference type or a value type and If T is a value type, whether it will be a numeric value or a struct.
In your case it assigns 0.
static void Main(string[] args)
{
HardwareInterfaceType type = default(HardwareInterfaceType);
Console.WriteLine(type.ToString());
type = HardwareInterfaceType.Gpib;
Console.WriteLine(type.ToString());
Console.ReadLine();
}
public enum HardwareInterfaceType
{
Gpib = 1,
Vxi = 2,
GpibVxi = 3,
}
//output
0
Gpib