internal static void ThrowIfDeclaringTypeNotGeneric(CILElementOwnedByType element, CILTypeBase[] gArgs) { var gDef = element.DeclaringType.GenericDefinition; if (gDef == null && gArgs != null && gArgs.Length != 0) { throw new InvalidOperationException("This method can only be used on elements declared in generic types."); } }
internal static void ThrowIfDeclaringTypeGenericButNotGDef(CILElementOwnedByType element) { var gDef = element.DeclaringType.GenericDefinition; if (gDef != null && !Object.ReferenceEquals(gDef, element.DeclaringType)) { throw new InvalidOperationException("This method can not be used on generic types, which are not generic type definitions."); } }