IsGenericType() public static method

public static IsGenericType ( IEntity entity ) : bool
entity IEntity
return bool
Beispiel #1
0
 /// <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);
 }
Beispiel #2
0
 /// <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);
 }