Even more C#

using System;

class StringExample {

public static int main() {

string s1 = “a string”;

string s2 = s1;// copy, not reference to the same address

Console.WriteLine(“s1 is ” +  s1);

Console.WriteLine(“s2 is ” + s2);

s1 = “another string”;

Console.WriteLine(“s1 is ” + s1);

Console.WriteLine(“s2 is ” + s2);

return 0;

}

“s1 is a string”

“s2 is a string”

“s1 is now another string”

“s2 is now a string”

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s