private int DetermineGenericParamInheritance() { if (DeclaringType == null) { return(GenericParameters.Where(x => !x.IsInherited).Count()); } var ancestorParamCount = DeclaringType.DetermineGenericParamInheritance(); if (!_checkedGenericParamInheritance) { for (var i = 0; i < ancestorParamCount; i++) { GenericParameters[i].IsInherited = true; } } _checkedGenericParamInheritance = true; return(ancestorParamCount + GenericParameters.Where(x => !x.IsInherited).Count()); }