public void StructsPassedToFunctionsAreCopied()
        {
            // When a struct is passed to a function, it is also copied.
            // So if an object of a struct is at address X in memory, and is
            // passed to a function, the variable in the function will point to a
            // copy at another address Y.
            StructWithPublicField obj = new StructWithPublicField();

            obj.n = 1;
            Assign10ToN(obj);
            Assert.Equal(1, obj.n);
        }
 public void StructsAreCopied()
 {
     // An important difference is that objects of structs are not held
     // by reference. So assigning it to another variable copies the
     // object. If an object of struct is at address X in memory, and is
     // assigned to another variable, that new variable will point to a
     // copy at another address Y.
     StructWithPublicField obj1 = new StructWithPublicField();
     obj1.n = 1;
     StructWithPublicField obj2 = obj1;
     obj2.n = 2;
     Assert.AreEqual(FILL_ME_IN, obj1.n);
 }
        public void StructsAreCopied()
        {
            // An important difference is that objects of structs are not held
            // by reference. So assigning it to another variable copies the
            // object. If an object of struct is at address X in memory, and is
            // assigned to another variable, that new variable will point to a
            // copy at another address Y.
            StructWithPublicField obj1 = new StructWithPublicField();

            obj1.n = 1;
            StructWithPublicField obj2 = obj1;

            obj2.n = 2;
            Assert.Equal(1, obj1.n);
        }
 void Assign10ToN(StructWithPublicField objInFunction)
 {
     objInFunction.n = 10;
 }
 public void H_StructsPassedToFunctionsAreCopied()
 {
     // When a struct is passed to a function, it is also copied.
     // So if an object of a struct is at address X in memory, and is
     // passed to a function, the variable in the function will point to a
     // copy at another address Y.
     StructWithPublicField obj = new StructWithPublicField();
     obj.n = 1;
     Assign10ToN(obj);
     Assert.Equal(FILL_ME_IN, obj.n);
 }
 void Assign10ToN(StructWithPublicField objInFunction)
 {
     objInFunction.n = 10;
 }