/// <summary> /// Checks if a specified entity is not a generic definition. /// </summary> public bool NotGenericDefinition(IEntity entity) { if (!(GenericsServices.IsGenericType(entity) || GenericsServices.IsGenericMethod(entity))) { Errors.Add(CompilerErrorFactory.NotAGenericDefinition(ConstructionNode, entity.FullName)); return(true); } return(false); }
/// <summary> /// Gets the generic parameters associated with a generic type or generic method definition. /// </summary> /// <returns>An array of IGenericParameter objects, or null if the specified entity isn't a generic definition.</returns> private static IGenericParameter[] GetGenericParameters(IEntity definition) { if (GenericsServices.IsGenericType(definition)) { return(((IType)definition).GenericInfo.GenericParameters); } if (GenericsServices.IsGenericMethod(definition)) { return(((IMethod)definition).GenericInfo.GenericParameters); } return(null); }