Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. List<customer> customerList;
  2.  
  3. List<customer> customerList=customerList.Where(p=>p.Country.Equals("India") && p.Status.Equals("A")).ToList();
  4.  
  5. List<customer> customerList=customerList.Where(p=>p.Country.Equals("India")).Where(p=>p.Status.Equals("A")).ToList();
  6.  
  7. List<customer> customerList=customerList.Where(p=>p.Country.Equals("India")).ToList();
  8. customerList=customerList.Where(p=>p.Status.Equals("A")).ToList();
  9.  
  10. customerList.Where(p=>p.Country == "India" && p.Status == "A").ToList();
  11.  
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Linq;
  15. using System.Text;
  16.  
  17. namespace ConsoleApplication4 {
  18. public class Customer {
  19. public string Country { get; set; }
  20. public string Status { get; set; }
  21. }
  22.  
  23. class Program {
  24. static void Main(string[] args) {
  25. var list = new List<Customer>();
  26. list.Add(new Customer() { Country = "India", Status = "A" });
  27. list.Add(new Customer() { Country = "USA", Status = "A" });
  28.  
  29. var results = list.Where((c) => c.Country == "India" && c.Status == "A");
  30.  
  31. if (results.Any()) {
  32. Console.WriteLine(results.First().Country);
  33. }
  34.  
  35. Console.ReadLine();
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement