Cast a property to its actual type dynamically using reflection (where actual type is generic)
问题 This is a slightly different question asked here. I modified the same code into my needs like below: using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace cns01 { class Program { public class ClassA<T> { public int IntProperty { get; set; } = 999; } public class ClassB<T2> { public ClassA<int> MyIntProperty { get; set; } public ClassA<string> MyStringProperty { get; set; } } static void Main