mercredi 9 août 2017

Modify property retrieved at runtime

I have a class that I'd like to be generic in that I can specify the property to retrieve from the object at runtime. The reason for this is that we have a database table accessed via Entity Framework that has many columns such as,

  1. table.name1
  2. table.name2
  3. table.name3
    .
    .
    .

Terrible legacy table notwithstanding, I'd like to do something similar to the following while allowing for either indexing or straight-out specifying the object property.

public string Name
{ 
    get { return name<#>; } 
}

Thanks!





Aucun commentaire:

Enregistrer un commentaire