c# foreach (property in object)… Is there a simple way of doing this?

前端 未结 9 2074
感情败类
感情败类 2020-11-28 22:10

I have a class containing several properties (all are strings if it makes any difference).
I also have a list, which contains many different instances of the class.

9条回答
  •  余生分开走
    2020-11-28 22:30

    A small word of caution, if "do some stuff" means updating the value of the actual property that you visit AND if there is a struct type property along the path from root object to the visited property, the change you made on the property will not be reflected on the root object.

提交回复
热议问题