jeudi 10 décembre 2015

How to set a property of object in a class by reflection with a string value [duplicate]

This question already has an answer here:

Following is my code:

public class BucklingTentedBallooning
    {
        public Wood Wood{ get; set; }
    }

 public class Wood
    {
        public string Species { get; set; }
        public string Manufacturer { get; set; }
        public string Grade { get; set; }
        public string DimentionalStability { get; set; }
        public string Hardness { get; set; }

    }

I want to set the value of Species property of Wood object of BucklingTentedBallooning class by reflection.

How to set the value in c#

May be like this setvalue("Wood.Species","aaa")





Aucun commentaire:

Enregistrer un commentaire