rahul shekar

rahul shekar

  • NA
  • 10
  • 2.4k

Retrieve value from array class

Oct 19 2016 8:31 AM
I have a class as below
 
public partial class Property
{
public string keyField { get; set; }

public object valueField { get; set; }
}
 
i am now creating a property like this
 
private string TrackingId { get; set; }
private string ApplicationId { get; set; } 
public Property[] Properties;
 
and assiging values like,
 
Properties = new Property[3];
Properties[0] = new Property { key = "XXX", value = TrackingId };
Properties[1] = new Property { key = "YYY", value = ApplicationId }; 
 
now i need to retrieve value from collection property dynamically, as of now i know only to retrieve static as 
 string key = request.Properties[0].key[0].ToString();
string value = (string)request.Properties[0].value;
 
 is there possibility to take dynamically by not using index value hard coded & not using for loop

Answers (2)