C# 4.0 dynamics
- by mehanik
Hi. Code bellow is working well until I have class ClassSameAssembly in same assembly as class Program.
But when I move class ClassSameAssembly to separate assembly I have runtime error.
Is it posible to resolve it?
using System;
namespace ConsoleApplication2
{
public static class ClassSameAssembly
{
public static dynamic GetValues()
{
return new
{
Name = "Michael", Age = 20
};
}
}
internal class Program
{
private static void Main(string[] args)
{
var d = ClassSameAssembly.GetValues();
Console.WriteLine("{0} is {1} years old", d.Name, d.Age);
}
}
}