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

            return(y.Value);
        }
Exemplo n.º 4
0
        public static int UseNullable1(int x)
        {
            MyNullable <int> y = new MyNullable <int>(x);

            return(y.Value);
        }
Exemplo n.º 5
0
 public static void Test1(MyNullable <int> optInt)
 {
     int x = optInt.Value;
 }