5
Answers

how to use a list as a property

George Loveless

George Loveless

14y
3k
1
This little bit of code wasn't working for me.  I was wondering the proper way to use a list as a property, instead of setting it as a public member.
Class Company
{
   ..
   private list<string> employees{get; set;}
   ..
}

..
..// in main.
  Company myCompany = new Company();
  myCompany.employees.add("jim");    // doesn't work
  myCompany.employees.add("sue");   // doesn't work
 


 Thank you much.

Answers (5)