Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<customer> customerList;
- List<customer> customerList=customerList.Where(p=>p.Country.Equals("India") && p.Status.Equals("A")).ToList();
- List<customer> customerList=customerList.Where(p=>p.Country.Equals("India")).Where(p=>p.Status.Equals("A")).ToList();
- List<customer> customerList=customerList.Where(p=>p.Country.Equals("India")).ToList();
- customerList=customerList.Where(p=>p.Status.Equals("A")).ToList();
- customerList.Where(p=>p.Country == "India" && p.Status == "A").ToList();
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication4 {
- public class Customer {
- public string Country { get; set; }
- public string Status { get; set; }
- }
- class Program {
- static void Main(string[] args) {
- var list = new List<Customer>();
- list.Add(new Customer() { Country = "India", Status = "A" });
- list.Add(new Customer() { Country = "USA", Status = "A" });
- var results = list.Where((c) => c.Country == "India" && c.Status == "A");
- if (results.Any()) {
- Console.WriteLine(results.First().Country);
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement