Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I iterate through instances of a class in C#?

Is there a way to iterate over instances of a class in C#? These instances are not tracked or managed in a collection.

like image 476
Asaf Avatar asked Dec 29 '22 10:12

Asaf


1 Answers

Not inside the regular framework. You would need to track them manually.

You can, however, do this in windbg/sos - mainly for debugging purposes (not for routine code).

like image 190
Marc Gravell Avatar answered Jan 12 '23 15:01

Marc Gravell