Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Class MyInfoClass
  2. {
  3.  
  4. Queue<float> firstQ = new Queue<float>();
  5. Queue<float> secondQ = new Queue<float>();
  6. Queue<float> thirdQ = new Queue<float>();
  7. Queue<float> fourthQ = new Queue<float>();
  8. Queue<float> fifthQ = new Queue<float>();
  9.  
  10. }
  11.  
  12. class myParamClass
  13. {
  14. internal static string[] Chain =
  15. {
  16. "firstQ",
  17. "secondQ",
  18. "thirdQ",
  19. "fourthQ",
  20. "fifthQ"
  21. }
  22. }
  23.  
  24. class Program
  25. {
  26. static void Main(string[] args)
  27. {
  28. MyInfoClass myInfoChain = new MyInfoClass();
  29.  
  30. float i = 0;
  31.  
  32. //attempt to set
  33. foreach (string qName in MyParamClass.Chain)
  34. {
  35. i++;
  36. myInfoChain.GetType().GetProperty(qName).SetValue(myInfoChain,i);
  37. }
  38. //attempt to get
  39. foreach (string qName in MyParamClass.Chain)
  40. {
  41. Trace.WriteLine(myInfoChain.GetType().GetProperty(qName).GetValue(myInfoChain,null));
  42. }
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement