refsList Activator CreateInstance innerRootProp PropertyType Declaring

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
refsList = Activator.CreateInstance(innerRootProp.PropertyType.DeclaringType) as IList;
refsList = Activator.CreateInstance(
innerRootProp.PropertyType.MakeGenericType(innerRootProp.PropertyType.GetGenericArguments()) // ReflectedType
) as IList;
refsList = Activator.CreateInstance(
innerRootProp.PropertyType.MakeGenericType(innerRootProp.PropertyType.DeclaringType) // MakePointerType() ReflectedType
) as IList;
refsList = Activator.CreateInstance(
innerRootProp.PropertyType.MakeGenericType(innerRootProp.PropertyType.MakePointerType()) // ReflectedType
) as IList;
refsList = Activator.CreateInstance(
innerRootProp.PropertyType.MakeGenericType(innerRootProp.PropertyType.ReflectedType)
) as IList;