Nullable Type C# with Example



Nullable Type C# with Example

 	using System;

	namespace CSharpIntermediateConstructsNullable
	{
		class NullableType
		{
			static void Main(string[] args)
			{
				int? myInt1 = 15;
				if (myInt1 != null)
					Console.WriteLine("Value of Nullable Type via != Comparision: {0}", myInt1);
				
				if (myInt1.HasValue)
					Console.WriteLine("Value of Nullable Type via HasValue Property: {0}", myInt1);				
			}
		}
	}
 

0 Comment's

Comment Form