vendredi 12 mai 2017

Display Properties in property grid during runtime using reflection

class  People
{
  public string Name {get; set;}

  public string Age {get; set;}

  public People()
  {
    Assembly assembly = Assembly.LoadFile("...fileName.dll");
    Type type = assembly.GetType("OtherPeopleClass");
    PropertyInfo[] prop = type.GetProperties();
  }
}

I am having a class 'People' whose properties(Name,Age) are displayed in the property grid during run time. I have fetched properties from an other assembly(In variable 'prop') and now want to add this properties to this class so that they are also included in my Property Grid.

I only need to display the fetched property in 'get; set;' format so that they are recognized and displayed in my property grid.





Aucun commentaire:

Enregistrer un commentaire