Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dog
- {
- public string Name { get; set; }
- public int Age { get; set; }
- }
- static void Main()
- {
- List<Dog> dogs = new List<Dog>()
- {
- new Dog { Name = "Rex", Age = 4 },
- new Dog { Name = "Sharo", Age = 0 },
- new Dog { Name = "Stasi", Age = 3 }
- };
- var newDogsList = dogs.Select(x => new { Age = x.Age, FirstLetter = x.Name[0] });
- }
Advertisement
Add Comment
Please, Sign In to add comment