To implement "method-missing"-semantics and such in C# 4.0, you have to implement IDynamicObject:
public interface IDynamicObject
{
MetaObject GetMetaObject(Expression parameter);
}
As far as I can figure out IDynamicObject is actually part of the DLR, so it is not new. But I have not been able to find much documentation on it.
The...
I was trying to figure out how to implement method_missing in C# 4, based on all of 2 blog posts floating around on IDynamicObject.
What I want to do is have a Business Logic Layer that has a Repository, and if the method is missing from the Business Logic Layer, just call the Repository and pass through its result. So i have a class ...
I've implemented IDynamicObject in C# 4, return a custom MetaObject subclass that does simple property getter/setter dispatch to a Dictionary. Not rocket science.
If I do this:
dynamic foo = new DynamicFoo();
foo.Name = "Joe";
foo.Name = "Fred";
Console.WriteLine(foo.Name);
Then 'Joe' is printed to the console... the second call t...
I installed VS.Net 2010 to play around with some of the new C# features and I'm trying to use the IDynamicObject interface but I can't because it can't find the System.Scripting namespace. What do I need to install to get this?
Thanks!
...
I have a subclass of DynamicObject and I would like to implement implicit casting for primitive types similarly as DO's explicit casting method TryConvert; that is, without writing multiple implicit operator [type] functions.
Usage:
dynamic myDynamicObject = new MyDynamicObject("1");
int sum = 1 + myDynamicObject; // instead of int i =...
When trying to run the sample code here: http://www.nikhilk.net/Live-Search-REST-API.aspx
I get:
Error 52 The type or namespace name 'IDynamicObject' could not be found (are you missing a using directive or an assembly reference?) E:\repo\NikhilK-dynamicrest-a93707a\NikhilK-dynamicrest-a93707a\Core\DynamicObject.cs 19 43 Dyn...