Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Browser;
- using System.Dynamic;
- namespace CodeInVain.Examples.Silverlight
- {
- class DynamicScriptObject:DynamicObject
- {
- private dynamic source;
- public DynamicScriptObject(dynamic source)
- {
- this.source = source;
- }
- public override bool TryGetMember(GetMemberBinder binder, out object result)
- {
- string memberName = binder.Name;
- result = null;
- object value = null;
- if (source is ScriptObject)
- {
- value = (source as ScriptObject).GetProperty(memberName);
- }
- if (value != null)
- {
- result = new DynamicScriptObject(value);
- }
- return true;
- }
- public dynamic Value
- {
- get { return source; }
- }
- public override string ToString()
- {
- return source.ToString();
- }
- }
- }
Add Comment
Please, Sign In to add comment