The default Generic Value - CSharp Custom Type

CSharp examples for Custom Type:Generics

Introduction

The default keyword can be used to get the default value for a generic type parameter.

The default value for a reference type is null, and the default value for a value type is the result of bitwise-zeroing the value type's fields:

static void test<T> (T[] array)
{
  for (int i = 0; i < array.Length; i++)
    array[i] = default(T);
}

Related Tutorials