Created
May 31, 2010 16:25
-
-
Save codeinvain/419980 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment