PDC09 Day 1 – Dynamics in C# 4
Switched to the Dynamics in C# 4 session. This session hall is not full at all… I’d rather say it is pretty empty… Probably this session is for real technology geeks like me :)
Did you know, that you cold create your own dynamic object by deriving from DynamicObject base class?
class Program
{
static void Main(string[] args)
{
dynamic d = new myDynamic();
Console.WriteLine(d++);
}
}
class myDynamic : DynamicObject
{
public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result)
{
Console.WriteLine(binder.Operation);
result = 25;
return true;
}
}
Nice :)
Stay tuned,
Alex