A
Andre Boeder
In one of my test classes there is a code fragment like this:
protected System.Collections.Hashtable pData;
public System.Collections.Hashtable PData
{
get
{
//TODO: read PData from DB
System.Console.WriteLine("GET Hashtable");
return pData;
}
set { pData = value; }
}
In my test console application there is somethink like this:
Class1 test = new Class1();
System.Collections.Hashtable ht = test.PData;
Now, why do I get "GET Hashtable" 9 times !!! in the console when
debugging ? It seems that the code is really executed 9 times.
Why I tried this is I wanted to test behaviour of Properties when
using direct access like
test.PData.Add("Test", "A")
But then the whole app crashes.
Maybe you can tell me a little bit about my problem and the usage of
Properties.
Thanks,
Andre
protected System.Collections.Hashtable pData;
public System.Collections.Hashtable PData
{
get
{
//TODO: read PData from DB
System.Console.WriteLine("GET Hashtable");
return pData;
}
set { pData = value; }
}
In my test console application there is somethink like this:
Class1 test = new Class1();
System.Collections.Hashtable ht = test.PData;
Now, why do I get "GET Hashtable" 9 times !!! in the console when
debugging ? It seems that the code is really executed 9 times.
Why I tried this is I wanted to test behaviour of Properties when
using direct access like
test.PData.Add("Test", "A")
But then the whole app crashes.
Maybe you can tell me a little bit about my problem and the usage of
Properties.
Thanks,
Andre