using System.Collections.Generic;
public static void Main()
var dict = new Dictionary<string, Parent>();
dict.Add("a", new ChildA());
dict.Add("b", new ChildB());
Console.WriteLine(dict.GetItem<ChildA>("a").GetType());
Console.WriteLine(dict.GetItem<ChildA>("b").GetType());
public abstract class Parent {}
public class ChildA : Parent {}
public class ChildB : Parent {}
public static T GetItem<T>(this Dictionary<string, Parent> instance, string key)
return (T)Convert.ChangeType(instance[key], typeof(T));