private void DeriveGenericTypeVariables()
{
//FieldInfo field = fieldDescriptor.Field;
Type genericType = Field.FieldType;
List<GenericTypeVar> derivedGenericTypeVars = new List<GenericTypeVar>();
if (genericType.IsGenericParameter)
{
GenericTypeVar g = GenericTypeVar.GetGenericTypeVarRef(genericType, GetGenericTypeVarsContext());
derivedGenericTypeVars.Add(g);
}
else
{
TypeInfo typeInfo = genericType.GetTypeInfo();
if (typeInfo.IsGenericType)
{
Type[] types = typeInfo.GenericTypeArguments;
if (types == null | types.Length <= 0)
return;
foreach (Type t in types)
{
GenericTypeVar g = GenericTypeVar.GetGenericTypeVarRef(t, GetGenericTypeVarsContext());
derivedGenericTypeVars.Add(g);
}
}
}
SetGenericTypeVars(derivedGenericTypeVars);
}