say there is a class like
class phones
{
    public int Id {get; set;}
    public string Name {get; set;}
    public string Color {get; set;}
    public decimal Price {get; set;}
}
List<phones> myList = GetData();
//list is filled with objects
Now, I know the Id and the exact name of the object's property and want to get the value from the matching object.
private string GetValue(int pid, string featurename)
{
  string val = "";
 foreach(phones obj in myList)
  {
   if(obj.Id == pid)
    {
      //if featurename is 'Name', it should be
      //val = obj.Name;
      //if featurename is 'Price', it should return
      //val = obj.Price;
      break;
    }
  }
  return val;
}
Is this possible. Please advise.
 
     
     
     
    