Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public class Employee
  2. {
  3. public int Id { get; set; }
  4. public string Name { get; set; }
  5. }
  6.  
  7. IList<Employee> EmpList ;
  8.  
  9. Or
  10.  
  11. List<Employee> EmpList ;
  12.  
  13. IList<Employee> EmpList = new List<Employee>();
  14.  
  15. List<Employee> EmpList = new List<Employee>();
  16.  
  17. IList<Employee> EmpList = new IList<Employee>();
  18.  
  19. //this will not compile
  20. IList<Employee> EmpList = new IList<Employee>();
  21.  
  22. //this is what you're really looking for:
  23. List<Employee> EmpList = new List<Employee>();
  24.  
  25. //but this will also compile:
  26. IList<Employee> EmpList = new List<Employee>();
  27.  
  28. [SerializableAttribute]
  29. public class List<T> : IList<T>, ICollection<T>,
  30. IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>,
  31. IEnumerable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement