Tuesday, November 9, 2010

String is a reference type. In the below code, what would be the output?

class Program
{
static void Main(string[] args)
{
string s = "abc";
CallMethod(s);
Console.WriteLine(s);
Console.Read();

}
static void CallMethod(string s)
{
s = "xyz";
}
}

Output: abc

No comments: