Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Accessing array by reflection
  2. maket.GetType()
  3.      .GetProperty(q.xmltags)
  4.      .SetValue(maket,Array.CreateInstance(q.xmltag),0
  5.       ), null);
  6.        
  7. var tag = maket.GetType().GetProperty(q.xmltags).GetValue(maket, null);
  8.        
  9. dynamic temp = tag;
  10. tag = temp.ToList().Add(test).ToArray();
  11.        
  12. var list = Enumerable.ToList(temp);
  13. list.Add(test);
  14. tag = Enumerable.ToArray(list);
  15.        
  16. IList list = {reflection "get" code}
  17. list.Add(test);
  18.        
  19. maket.GetType()
  20.  .GetProperty(q.ObjectType.xmltag)
  21.  .SetValue(maket, tag , null);
  22.        
  23. var arrayList = new ArrayList((Array)tag);
  24. arrayList.Add(newValue);
  25. tag = arrayList.ToArray((Type)q.xmltag);