>private void _LoadClients() >{ > _colClients.Clear(); > > MessageBox.Show(_colClients.Count.ToString()); // I addd this > > csClients oClients = new csClients(); > oClients.LoadData(this.iRecordId); > _colClients = oClients.colData; >} > >>
csCompany oCompany = new csCompany();
>>class csCompany >{ > public int iCount = 0; > > private ArrayList _colClients = new ArrayList(); > public ArrayList colClients > { > get > { > if (_colClients.Count == 0) > { > _LoadClients(); > } > return _colClients; > } > } > > private void _LoadClients() > { > iCount = 100; > } >} >>
>namespace Test >{ > class Program > { > static void Main(string[] args) > { > csCompany oCompany = new csCompany(); > int x = oCompany.iCount; // Returns 0; > } > } >} >>