Beispiel #1
0
        public void EnableExtendingSealedClasses()
        {
            // Event though the host class is sealed, we can use the sum method as though it were a member
            var ssc = new SomeSealedClass {
                A = 6, B = 200
            };

            Assert.Equal(206, ssc.Sum());
        }
Beispiel #2
0
 public static int Sum(this SomeSealedClass ssc)
 {
     return(ssc.A + ssc.B);
 }