Imagine we have a mutable struct (yes, don\'t start):
public struct MutableStruct
{
public int Foo { get; set; }
public override string
You can do this even easier. Try this under .NET 4.5 where we have dynamic.
struct Test
{
public Int32 Number { get; set; }
public override string ToString()
{
return this.Number.ToString();
}
}
class Program
{
static void Main( string[] args )
{
Object test = new Test();
dynamic proxy = test;
proxy.Number = 1;
Console.WriteLine( test );
Console.ReadLine();
}
}
I know it's not reflection but still fun though.