Simple Anonymous Methods for printing the square root : Anonymous « LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.ComponentModel;

    class MainClass
    {
        static void Main()
        {
            Action<int> printRoot = delegate(int number)
                {
                    Console.WriteLine(Math.Sqrt(number));
                };


            printRoot(2);
        }
    }








22.12.Anonymous
22.12.1.Anonymous Method
22.12.2.Anonymous Type
22.12.3.Anonymous Type In Array
22.12.4.Anonymous Types
22.12.5.Object Initializer
22.12.6.Create new object from query
22.12.7.Simple Anonymous Methods for calculating the mean value
22.12.8.Simple Anonymous Methods for printing out reverse numbers
22.12.9.Simple Anonymous Methods for printing the square root
22.12.10.Return From Anonymous Method
22.12.11.Using Anonymous Methods with Find
22.12.12.Array of anonymous types
22.12.13.Construct instance for nested class
22.12.14.Implicit Local Variables with Anonymous Types