B
Bill McCormick
Hi C# programmers,
I'd like to be able to call a static function or property and have it
return a generic list. The compiler indicates that "static types cannot
be used as generic arguments", so I'm looking for the correct way to do
this and/or other alternatives.
The static function should make some DB query, build some objects
foreach record and populate a List<T>. In the end, I'd like to be able
to use it like this:
foreach(Item item in MyListFunction) DoSomethingWith(item);
I'd like to do this without having to first create a List and fill it
with whatever, so behind MyListFunction is the DB query, List creation,
object building and filling of the List.
Thanks,
Bill
I'd like to be able to call a static function or property and have it
return a generic list. The compiler indicates that "static types cannot
be used as generic arguments", so I'm looking for the correct way to do
this and/or other alternatives.
The static function should make some DB query, build some objects
foreach record and populate a List<T>. In the end, I'd like to be able
to use it like this:
foreach(Item item in MyListFunction) DoSomethingWith(item);
I'd like to do this without having to first create a List and fill it
with whatever, so behind MyListFunction is the DB query, List creation,
object building and filling of the List.
Thanks,
Bill