Public class MyClass { string city ; string state ; string etc ; }When I need to read or set the values of the fields, I usually know the field names but now I want to make a generic method that can iterate through all the fields and check for specific content.
MyClass oMyClass = new MyClass() oMyClass.city = "New Milford"; oMyClass.state = "disillusion" ; oMyClass.etc = "etcetera,etcetera"; System.Reflection.FieldInfo[] oFieldInfo = oMyClass.GetType().GetFields() ; for(int i = 0 ; i < oFieldInfo.Length ; i++) { MessageBox.Show(oFieldInfo[i].Name.ToString()) ; }Anyone know if I’m on the right track here?