Browsed by
Tag: loop

C# Iterate through Class properties

C# Iterate through Class properties

You could possibly use Reflection to do this. As far as I understand it, you could enumerate the properties of your class and set the values. You would have to try this out and make sure you understand the order of the properties though. Refer to this MSDN Documentation for more information on this approach. For a hint, you could possibly do something like:

Where value is the value you’re wanting to write in (so from your resultItems array).