Convert a dynamic type to a concrete object in .NET C#
February 7, 2017 Leave a comment
Dynamic objects in C# let us work with objects without compile time error checking in .NET. They are instead checked during execution. As a consequence we can’t use IntelliSense while writing the code to see what properties and functions an object has.
Consider the following Dog class:
public class Dog
{
public string Name { get; }
public string Type { get;}
public int Age { get; }
public Dog(string name, string type, int age)
{
Name = name;
Type = type;
Age = age;
}
}