-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnonymousMethod.cs
49 lines (44 loc) · 1.27 KB
/
AnonymousMethod.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication5
{
internal class MyData
{
public string FirstName { get; set; }
public string Lastname { get; set; }
public DateTime Dob { get; set; }
public string MiddleName { get; set; }
}
public static class Program
{
public static void Main(string[] args)
{
var data = new List<MyData>
{
new MyData
{
FirstName = "harshal", Lastname = "Raverkar", MiddleName = "Test", Dob = new DateTime(1992, 10, 19)
},
new MyData
{
FirstName = "Test1", Lastname = "Raverkar1", MiddleName = "Test5", Dob = new DateTime(1992, 11, 20)
},
new MyData
{
FirstName = "Test2", Lastname = "Raverkar2", MiddleName = "Test3", Dob = new DateTime(1992, 01, 13)
},
new MyData
{
FirstName = "Test3", Lastname = "Raverkar3", MiddleName = "Test4", Dob = new DateTime(1992, 09, 14)
}
};
var anndata = from pl in data select new {pl.FirstName, pl.Lastname};
foreach (var variable in anndata)
{
Console.WriteLine("Name :" + variable.FirstName + " Last Name :"+ variable.Lastname);
}
}
}
}