Is there a 'foreach' equivalent for parts of a class? - C#