Using Default Expression in array - CSharp Language Basics

CSharp examples for Language Basics:default

Description

Using Default Expression in array

Demo Code

using System;//w w w  .j  ava 2s .c o m
class DefaultExpression2
{
   static void Main()
   {
      var intArray = new[] { default, 5 };
      var stringArray = new[] { default, "text" };
      var boolArray = new[] { default, true };
      Console.WriteLine(intArray[0]);
      Console.WriteLine(stringArray[0] == null);
      Console.WriteLine(boolArray[0]);
   }
}

Related Tutorials