wyrd
Senior Contributor
C#:
using System;
namespace ConsoleApplication3
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
new Class1();
}
public Class1() {
string stuff = "yayaya";
Console.WriteLine("before: " + stuff);
changeString(stuff);
Console.WriteLine("after: " + stuff);
Console.Read();
}
private void changeString(string str) {
str = "changed!";
Console.WriteLine("function changed: " + str);
}
}
}
This prints out the following;
before: yayaya
function changed: changed!
after: yayaya
Am I missing something?! I thought string was an object (reference type) while basic types like int, double, short, etc. and also enums and structures were value types.