24
1
using System;
2
3
public class Program
4
{
5
delegate bool IsTeenAger(Student stud);
6
7
public static void Main()
8
{
9
IsTeenAger isTeenAger = delegate(Student s) { return s.Age > 12 && s.Age < 20; };
10
11
Student stud = new Student() { Age = 25 };
12
13
Console.WriteLine(isTeenAger(stud));
14
15
16
}
17
}
18
19
public class Student{
20
21
public int Id { get; set; }
22
public string Name { get; set; }
23
public int Age { get; set; }
24
}
Cached Result
the value of a is 15
b is equal to 20
a is NOT equal to b
the value of A is 15 the value of B is 20
b is equal to 20
a is NOT equal to b
the value of A is 15 the value of B is 20