csharp loop class properties add to array

Code Example - csharp loop class properties add to array

                
                        Record record = new Record();

PropertyInfo[] properties = typeof(Record).GetProperties();
foreach (PropertyInfo property in properties)
{
    property.SetValue(record, value);
}
                    
                
 

csharp traverseall elements in class property

                        
                                SomeObject.GetType().GetProperties().ToList().ForEach(x => Console.WriteLine(%%%~COMPRESS~PRE~1~%%%quot;{x.Name} = {x.GetValue(SomeObject, null)}"));