Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class MyInfoClass
- {
- Queue<float> firstQ = new Queue<float>();
- Queue<float> secondQ = new Queue<float>();
- Queue<float> thirdQ = new Queue<float>();
- Queue<float> fourthQ = new Queue<float>();
- Queue<float> fifthQ = new Queue<float>();
- }
- class myParamClass
- {
- internal static string[] Chain =
- {
- "firstQ",
- "secondQ",
- "thirdQ",
- "fourthQ",
- "fifthQ"
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- MyInfoClass myInfoChain = new MyInfoClass();
- float i = 0;
- //attempt to set
- foreach (string qName in MyParamClass.Chain)
- {
- i++;
- myInfoChain.GetType().GetProperty(qName).SetValue(myInfoChain,i);
- }
- //attempt to get
- foreach (string qName in MyParamClass.Chain)
- {
- Trace.WriteLine(myInfoChain.GetType().GetProperty(qName).GetValue(myInfoChain,null));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement