0

I have this property class like:

public class ABC{

    public string a {get;set;}
    public int? b {get;set;}
    public string c {get;set;}
    public int? d {get;set;}
    public int? e {get;set;}
    public int? f {get;set;}  
}
    string lineabc = "8004CF::JAI2310:0:5:0";
    string[] splitrow = lineabc.Split(':');  

I have to loop through set all the values in this object property class, the values which i want to set in the object class by splitrow array value.

i don't want to set values one by one in class object property like :

ABC.a = splitrow[0];
Auguste
  • 2,007
  • 2
  • 17
  • 25
SanjeevD
  • 56
  • 6
  • You'll need to use reflection (specifically, the Type.GetProperties() method) to loop through the PropertyInfo array of the class, although reflection is not very performant. You may want to take a step back and reevaluate what it is you're trying to do. – aardvark May 19 '16 at 15:12
  • 1
    Possible duplicate of [How to loop through all the properties of a class?](http://stackoverflow.com/questions/531384/how-to-loop-through-all-the-properties-of-a-class) – BJ Myers May 19 '16 at 18:53

0 Answers0