using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LinqToUserDataApplication { public class User { public string UserName { get; set; } public string City { get; set; } public string Phone { get; set; } public override string ToString() { return UserName + "\t" + City + "\t" + Phone; } } class Program { static void Main(string[] args) { var users = new List { new User { UserName = "Смирнов", City = "Москва", Phone = "0201513165" }, new User { UserName = "Иванов", City = "Москва", Phone = "74854646" }, new User { UserName = "Петров", City = "Питер", Phone = "6786876" }, new User { UserName = "Сидоров", City = "Питер", Phone = "454849" }, new User { UserName = "Фленов", City = "Питер", Phone = "489678" }, new User { UserName = "Леонов", City = "Бабруйск", Phone = "7897964" } }; var results = from c in users where c.City == "Москва" select c; foreach (var c in results) Console.WriteLine(c); Console.ReadLine(); } } }