String Example C sharp
Here i am showing how to use string data in c sharp
using System;class Example
{
public static int Main()
{
string s1 = "a string"; //declare and assign value in string
string s2 = s1; // giving value of s1 to s2
Console.WriteLine("s1 is " + s1); // display value
Console.WriteLine("s2 is " + s2);
s1 = "another string"; //another declaration of string
Console.WriteLine("s1 is now " + s1);
Console.WriteLine("s2 is now " + s2);
return 0; // return is required because main function is int type
}
}
Now run this example in visual studio
0 Comments
thank you for your comment