This program is showing different methods of initializing the given string variable.
Case 1 is about initializing the string variable with empty string
Case 2 is about initializing the string variable with null string
Case 3 is about initializing the string variable with a value string
using System;
namespace ConsoleLab
{
class Programs
{
static void Main(string[] args)
{
//Initialize with empty string
string EmptyString = "";
//Initialize with null string
string NullString = null;
//Initialize with a value string
string ValueString = "Sample";
Console.WriteLine("Empty String: {0}", EmptyString);
Console.WriteLine("Null String: {0}", NullString);
Console.WriteLine("Value String: {0}", ValueString);
Console.ReadLine();
}
}
}
No comments:
Post a Comment