예제 #1
0
 public static int UseNullable(MyNullable <int> optY)
 {
     if (optY.HasValue)
     {
         return(optY.Value);
     }
     return(0);
 }
예제 #2
0
 public static void Pass(MyNullable <int> x)
 {
     Contract.Requires(x.HasValue);
 }
예제 #3
0
        public static int UseNullable2(int x)
        {
            MyNullable <int> y = x;

            return(y.Value);
        }
예제 #4
0
        public static int UseNullable1(int x)
        {
            MyNullable <int> y = new MyNullable <int>(x);

            return(y.Value);
        }
예제 #5
0
 public static void Test1(MyNullable <int> optInt)
 {
     int x = optInt.Value;
 }