public void Classes_are_passed_by_reference()
        {
            var s = new SomeClass(1, 2);

            Modify(s);

            Assert.AreEqual(123, s.X);
            Assert.AreEqual(2, s.Y);
        }
        public void Passing_a_reference_type_as_ref_allows_the_method_to_change_the_actual_reference_and_not_just_the_referenced_object()
        {
            var s1 = new SomeClass(1, 2);
            var s2 = s1;

            Assert.AreSame(s1, s2);

            // DON'T DO THIS!
            ReferenceAnotherObject(ref s1);

            Assert.AreNotSame(s1, s2);
        }
 private void Modify(SomeClass s)
 {
     // These changes do actually affect the original value
     s.X = 123;
 }
 private void ReferenceAnotherObject(ref SomeClass s)
 {
     s = new SomeClass(4, 5);
 }