Beispiel #1
0
        public void PassByValue()
        {
            var x = 1.4;

            Mystery2.Method2(x);
            Assert.AreEqual(1.4, x);


            Mystery2.Method2(2);
        }
Beispiel #2
0
        public void PassByReference()
        {
            var x = "1";

            Mystery2.Method(ref x);
            Assert.AreEqual("11", x);

            decimal dd = 98;
            // not legal Mystery2.Method(ref dd);
        }
Beispiel #3
0
        public void TryParseInt()
        {
            int asInt = 9;
            var x     = "13801";

            if (Mystery2.TryParseInt(x, out asInt))
            {
                Assert.AreEqual(13801, asInt);
            }

            if (Int32.TryParse(x, out var asInt2))
            {
                Assert.AreEqual(13801, asInt2);
            }
        }