Пример #1
0
        static void Main()
        {
            var m  = new Func <int>(() => 1);
            var vg = m.ToFirstUse();
            var v  = vg.Value;
            int i  = vg;

            int?           foo = 1;
            var            f3  = foo + 2;
            FirstUse <int> bi  = (Func <int>)(() => 1);
            int            f4  = 1 + bi;
            int            f5  = (int)new Nullable <int>(f4).ToFirstUseN();
            int            f6  = (int)((int?)f4).ToFirstUseN();
        }
Пример #2
0
 /// <summary>
 /// Makes an Initializer to be called only on first use
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="func"></param>
 /// <returns></returns>
 public static FirstUse <T> ToFirstUse <T>(this FirstUse <T> func)
 {
     return(func);
 }