Beispiel #1
0
        public static string doAnonymousMethod(string textDemo)
        {
            getString anonymousFunc = delegate(string str)
            {
                return(str);
            };

            return(anonymousFunc(textDemo));
        }
Beispiel #2
0
        public static string doAnonymousMethod()
        {
            getString anonymousFunc = delegate(string str)
            {
                return(str);
            };

            return(anonymousFunc("bye bye"));
        }
        public static void Main(string[] args)
        {
            // Instantiate the delegate type using an anonymous method.
            getString str = delegate(string j)
            {
                System.Console.WriteLine(j);
            };

            // Results from the anonymous delegate call.
            str("The delegate using the anonymous method is called.");
        }