CodeQL library for C#
Search

Class Type

A type.

Import path

import semmle.code.cil.Type

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getABaseInterface

Gets an immediate base interface of this class, if any.

getABaseType

Gets an immediate base type of this type, if any.

getALocation

Gets a location of this element, which can include locations in both DLLs and source files.

getAMember

Gets a member of this type, if any.

getASubtype

Gets an immediate subtype of this type, if any.

getBaseClass

Gets the immediate base class of this class, if any.

getConversionIndex

Gets an index for implicit conversions. A type can be converted to another numeric type of a higher index.

getDeclaringType

Gets the containing type of this type, if any.

getName

Gets the name of this element.

getNamespace

Gets the namespace directly containing this type, if any.

getParent

Gets the parent of this type container, if any.

getUnboundDeclaration

Gets the unbound version of this declaration, that is, the declaration where all type arguments have been removed. For example, in

getUnboundType

Gets the unbound generic type of this type, or this if the type is already unbound.

getUnderlyingType

Gets the machine type used to store this type.

hasQualifiedName

Holds if this element has the qualified name qualifier.name.

isClass

Holds if this type is a class.

isEnum

Holds if this type is an enum.

isInterface

Holds if this type is an interface.

isPrivate

Holds if this type is private.

isPublic

Holds if this type is public.

isSystemType

Holds if this type is a member of the System namespace and has the name name. This is the same as getQualifiedName() = "System.<name>", but is faster to compute.

toString

Gets a textual representation of this element.

Inherited predicates

compiledFromSource

Holds if this element was compiled from source code that is also present in the database. That is, this element corresponds to another element from source.

from NamedElement
compiledFromSource

Holds if this element was compiled from source code that is also present in the database. That is, this element corresponds to another element from source.

from NamedElement
compiledFromSource

Holds if this element was compiled from source code that is also present in the database. That is, this element corresponds to another element from source.

from NamedElement
fromLibrary

Holds if this element is from an assembly.

from Element
fromLibrary

Holds if this element is from an assembly.

from Element
fromLibrary

Holds if this element is from an assembly.

from Element
fromSource

Holds if this element is from source code.

from Element
fromSource

Holds if this element is from source code.

from Element
fromSource

Holds if this element is from source code.

from Element
getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from Element
getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from Element
getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from Element
getAnAttribute

Gets an attribute (for example [Obsolete]) of this declaration, if any.

from Declaration
getCSharpDeclaration

Gets the C# declaration corresponding to this CIL declaration, if any. Note that this is only for source/unconstructed declarations.

from Declaration
getFile

Gets the file containing this element.

from Element
getFile

Gets the file containing this element.

from Element
getFile

Gets the file containing this element.

from Element
getLabel

Gets a unique string label for this element.

from NamedElement
getLabel

Gets a unique string label for this element.

from NamedElement
getLabel

Gets a unique string label for this element.

from NamedElement
getLanguage

Gets the “language” of this program element, as defined by the extension of the filename. For example, C# has language “cs”, and Visual Basic has language “vb”.

from Element
getLanguage

Gets the “language” of this program element, as defined by the extension of the filename. For example, C# has language “cs”, and Visual Basic has language “vb”.

from Element
getLanguage

Gets the “language” of this program element, as defined by the extension of the filename. For example, C# has language “cs”, and Visual Basic has language “vb”.

from Element
getLocation

Gets the location of this element.

from Element
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from Element
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from Element
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from Element
getQualifiedName

Gets the fully qualified name of this element, for example the fully qualified name of M on line 3 is N.C.M in

from NamedElement
getQualifiedName

Gets the fully qualified name of this element, for example the fully qualified name of M on line 3 is N.C.M in

from NamedElement
getQualifiedName

Gets the fully qualified name of this element, for example the fully qualified name of M on line 3 is N.C.M in

from NamedElement
getSourceDeclaration

DEPRECATED: Use getUnboundDeclaration() instaed.

from Declaration
getSourceDeclaration

DEPRECATED: Use getUnboundDeclaration() instaed.

from Declaration
getUndecoratedName

Gets the name of this type without additional syntax such as [], *, or <...>.

from Type
hasName

Holds if this element has name ‘name’.

from NamedElement
hasName

Holds if this element has name ‘name’.

from NamedElement
hasName

Holds if this element has name ‘name’.

from NamedElement
hasQualifiedName

Holds if this element has qualified name qualifiedName, for example System.Console.WriteLine.

from NamedElement
hasQualifiedName

Holds if this element has qualified name qualifiedName, for example System.Console.WriteLine.

from NamedElement
hasQualifiedName

Holds if this element has qualified name qualifiedName, for example System.Console.WriteLine.

from NamedElement
hasUndecoratedName

Holds if this element has undecorated name ‘name’.

from Declaration
hasUndecoratedName

Holds if this element has undecorated name ‘name’.

from Declaration
isSourceDeclaration

DEPRECATED: Use isUnboundDeclaration() instead.

from Declaration
isUnboundDeclaration

Holds if this declaration is unbound.

from Declaration
isUnboundDeclaration

Holds if this declaration is unbound.

from Declaration
matchesHandle

Holds if other has the same metadata handle in the same assembly.

from NamedElement
matchesHandle

Holds if other has the same metadata handle in the same assembly.

from NamedElement
matchesHandle

Holds if other has the same metadata handle in the same assembly.

from NamedElement
toStringWithTypes

Gets the full textual representation of this element, including type information.

from TypeContainer