Guest User

Untitled

a guest
May 26th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Browser;
  6. using System.Dynamic;
  7.  
  8. namespace CodeInVain.Examples.Silverlight
  9. {
  10. class DynamicScriptObject:DynamicObject
  11. {
  12. private dynamic source;
  13. public DynamicScriptObject(dynamic source)
  14. {
  15. this.source = source;
  16. }
  17.  
  18. public override bool TryGetMember(GetMemberBinder binder, out object result)
  19. {
  20.  
  21. string memberName = binder.Name;
  22. result = null;
  23. object value = null;
  24. if (source is ScriptObject)
  25. {
  26. value = (source as ScriptObject).GetProperty(memberName);
  27. }
  28.  
  29. if (value != null)
  30. {
  31. result = new DynamicScriptObject(value);
  32. }
  33. return true;
  34. }
  35.  
  36. public dynamic Value
  37. {
  38. get { return source; }
  39. }
  40.  
  41. public override string ToString()
  42. {
  43. return source.ToString();
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment