B
Benjamin Joldersma
Hi all,
If I have a expensive public property that exposes a collection, say
via a call to a database:
public ArrayList Complex
{
get
{
//expensive call to db
return DbResult;
}
}
and use this in a foreach:
foreach( object o in Complex )
{
...
}
Will the clr call Complex only once, and save a reference to the
direct variable actually exposed, or will it execute the code in the
get routine each iteration?
Thanks in advance,
Ben Joldersma
Sr. Software Engineer,
Citadel Media, Inc.
If I have a expensive public property that exposes a collection, say
via a call to a database:
public ArrayList Complex
{
get
{
//expensive call to db
return DbResult;
}
}
and use this in a foreach:
foreach( object o in Complex )
{
...
}
Will the clr call Complex only once, and save a reference to the
direct variable actually exposed, or will it execute the code in the
get routine each iteration?
Thanks in advance,
Ben Joldersma
Sr. Software Engineer,
Citadel Media, Inc.