Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Property Get Runs When Class Instantiated
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Property Get Runs When Class Instantiated
Miscellaneous
Thread ID:
01394040
Message ID:
01394040
Views:
103
I have a property on a Company class:
private ArrayList _colClients = new ArrayList();
public ArrayList colClients
{
    get
    {
        if (_colClients.Count == 0)
        {
            _LoadClients();
        }
        return _colClients;
    }
}
When I instantiate the class, the colClients collection is being loaded. I put a breakpoint on the IF() inside the Get, but it doesn't break. Yet when I look at colClients.Count, it's set to 3 instances of a Client class.

Anyone know why the Get assesor is firing when the class is instantiated?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform