using System;
using System.Collections.Generic;
using System.Linq;
public delegate void Print(string value);
public class Program
{
/*{
Console.Write("kk");
}
*/
Func<int, int> square = x => x * x;
public static void Main()
var test1 = (string val) => Console.WriteLine("I am " + val);
Action<string> somerandonm;
somerandonm = delegate(string number)
Console.WriteLine(number);
};
Action<string> test = (val) => Console.WriteLine("I am " + val);
Action<string> some = Print;
List<string> names = new List<string>();
names.Add("Bruce");
names.Add("Alfred");
names.Add("Tim");
names.Add("Richard");
// Display the contents of the list using the Print method.
names.ForEach(Print);
// The following demonstrates the anonymous method feature of C#
// to display the contents of the list to the console.
names.ForEach(delegate(string name)
Console.WriteLine(name);
});
void Print(string s)
Console.WriteLine(s);
Print print = delegate(string val) {
Console.WriteLine("Inside Anonymous method. Value: {0}", val);
names.ForEach(somerandonm);
//var print1 = print as Action<string>;
//names.ForEach(some);
//test1(29374);
IEnumerable<int> squares =
Enumerable.Range(1, 10).Select(x => x * x);
foreach (int num in squares)
Console.WriteLine(num);
}*/
{for (int i = 0; i < 10; i++ )
Console.WriteLine(i++);
Console.WriteLine(i+=1);