>public class Employee() >{ > string sName = ""; >} >>
List<Employee> employees = new List<Employee>(); employees.Add(new Employee());To return it from a method, just specify the list of Employee as the return type:
public List<Employee> GetEmpCollection() { return new List<Employee>(); }Actually, I think it's suggested to use Collection<> for public types (List<> for internal collections) since it lets you receive notifications if the collection has changed (where List doesn't). So change that to:
public Collection<Employee> GetEmpCollection() { return new Collection<Employee>(); } Collection<Employee> employees = someClassInstance.GetEmpCollection();