using System;
public class TheClass
{
public int x;
}
public struct TheStruct
public class TestClass
public static void structtaker(TheStruct s)
s.x = 5;
public static void classtaker(TheClass c)
c.x = 5;
public static void Main()
TheStruct a = new TheStruct();
TheClass b = new TheClass();
a.x = 1;
b.x = 1;
structtaker(a);
classtaker(b);
Console.WriteLine("a.x = {0}", a.x);
Console.WriteLine("b.x = {0}", b.x);
//The output of the example shows that only the value of the class field was changed
// when the class instance was passed to the classtaker method. The struct field, however,
//did not change by passing its instance to the structtaker method. This is because a copy of the struct was passed to the structtaker method,
// while a reference to the class was passed to the classtaker method.