Table of Contents

Interface ITypeInfo

Namespace
NUnit.Framework.Interfaces
Assembly
nunit.framework.dll

The ITypeInfo interface is an abstraction of a .NET Type

public interface ITypeInfo : IReflectionInfo
Inherited Members

Properties

Assembly

Gets the assembly in which the type is declared

Assembly Assembly { get; }

Property Value

Assembly

BaseType

Gets the base type of this type as an ITypeInfo

ITypeInfo? BaseType { get; }

Property Value

ITypeInfo

ContainsGenericParameters

Gets a value indicating whether the Type has generic parameters that have not been replaced by specific Types.

bool ContainsGenericParameters { get; }

Property Value

bool

FullName

Gets the full name of the Type

string FullName { get; }

Property Value

string

IsAbstract

Gets a value indicating whether the type is abstract.

bool IsAbstract { get; }

Property Value

bool

IsGenericType

Gets a value indicating whether the Type is a generic Type

bool IsGenericType { get; }

Property Value

bool

IsGenericTypeDefinition

Gets a value indicating whether the Type is a generic Type definition

bool IsGenericTypeDefinition { get; }

Property Value

bool

IsSealed

Gets a value indicating whether the type is sealed.

bool IsSealed { get; }

Property Value

bool

IsStaticClass

Gets a value indicating whether this type is a static class.

bool IsStaticClass { get; }

Property Value

bool

Name

Gets the name of the Type

string Name { get; }

Property Value

string

Namespace

Gets the namespace of the Type

string? Namespace { get; }

Property Value

string

Type

Gets the underlying Type on which this ITypeInfo is based

Type Type { get; }

Property Value

Type

Methods

Construct(object?[]?)

Construct an object of this Type, using the specified arguments.

object Construct(object?[]? args)

Parameters

args object[]

Returns

object

GetConstructor(Type[])

Gets the public constructor taking the specified argument Types

ConstructorInfo? GetConstructor(Type[] argTypes)

Parameters

argTypes Type[]

Returns

ConstructorInfo

GetDisplayName()

Get the display name for this typeInfo.

string GetDisplayName()

Returns

string

GetDisplayName(object?[]?)

Get the display name for an object of this type, constructed with specific arguments

string GetDisplayName(object?[]? args)

Parameters

args object[]

Returns

string

GetGenericTypeDefinition()

Returns a Type representing a generic type definition from which this Type can be constructed.

Type GetGenericTypeDefinition()

Returns

Type

GetMethods(BindingFlags)

Returns an array of IMethodInfos for methods of this Type that match the specified flags.

IMethodInfo[] GetMethods(BindingFlags flags)

Parameters

flags BindingFlags

Returns

IMethodInfo[]

GetMethodsWithAttribute<T>(bool)

Returns all methods declared by this type that have the specified attribute, optionally including base classes. Methods from a base class are always returned before methods from a class that inherits from it.

IMethodInfo[] GetMethodsWithAttribute<T>(bool inherit) where T : class

Parameters

inherit bool

Specifies whether to search the fixture type inheritance chain.

Returns

IMethodInfo[]

Type Parameters

T

HasConstructor(Type[])

Returns a value indicating whether this Type has a public constructor taking the specified argument Types.

bool HasConstructor(Type[] argTypes)

Parameters

argTypes Type[]

Returns

bool

HasMethodWithAttribute(Type)

Returns a value indicating whether this type has a method with a specified public attribute

bool HasMethodWithAttribute(Type attrType)

Parameters

attrType Type

Returns

bool

IsType(Type)

Returns true if the Type wrapped is equal to the argument

bool IsType(Type type)

Parameters

type Type

Returns

bool

MakeGenericType(Type[])

Returns a new ITypeInfo representing an instance of this generic Type using the supplied Type arguments

ITypeInfo MakeGenericType(Type[] typeArgs)

Parameters

typeArgs Type[]

Returns

ITypeInfo