Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            UserDemo user = new UserDemo();

            WriteLine($"Import Static - 'using static namespace.classname;': {StaticFunction()}, {staticAutoProperty} ");
            WriteLine($"String Interpolation: {user.StringInterpolation}");
            WriteLine($"AutoProperty Inline Initializer: {user.AutoPropertyInlineInitializer}");
            WriteLine($"AutoGetOnlyProperty: {user.AutoGetonlyProperty}");
            WriteLine($"OnelineLamdaExpProperty: {user.OnelineLamdaExpProperty}");
            WriteLine($"OnelineLamdaExpFunction: {user.OnelineLamdaExpFunction()}");
            WriteLine($"OnelineLamdaExpFunctionWithParam: {user.OnelineLamdaExpFunctionWithParam("Dear")}");
            WriteLine($"NullConditionalOperator outmost null: {user.NullConditionalOperator(null, 0)}");
            WriteLine($"NullConditionalOperator 0 count: {user.NullConditionalOperator(new Dictionary<int, string>(), 1)}");
            WriteLine($"NullConditionalOperator value empty string: {user.NullConditionalOperator(user.intStringDictionary, 1000)}");
            WriteLine($"NullConditionalOperator value null: {user.NullConditionalOperator(user.intStringDictionary, 1001)}");
            WriteLine($"NullConditionalOperator value string: {user.NullConditionalOperator(user.intStringDictionary, 100)}");
            WriteLine($"Index Initializer: " + user.intStringDictionary.Aggregate("", (keyString, pair) => $"{keyString}[{pair.Key}]='{pair.Value}' "));
            WriteLine($"nameof(): {user.nameofExpression(new UserDemo())}");
            WriteLine($"Exception Filter: {user.ExceptionFilter()}");
            Task <string> t = user.AwaitInCatchFinally(true);

            t.Wait();
            WriteLine($"Await In Catch Finally: {t.Result}");

            // Question:
            // Exception Filters using when or if???
        }
Ejemplo n.º 2
0
 public string nameofExpression(UserDemo user)
 {
     return($"'nameof(user.firstName)' returns: {nameof(user.firstName)}");
 }