TypeDescriptor.GetReflectionType Method

Definition

Returns a Type that can be used to perform reflection.

Overloads

GetReflectionType(Object)

Returns a Type that can be used to perform reflection, given an object.

GetReflectionType(Type)

Returns a Type that can be used to perform reflection, given a class type.

GetReflectionType(Object)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns a Type that can be used to perform reflection, given an object.

C#
public static Type GetReflectionType(object instance);

Parameters

instance
Object

An instance of the target component.

Returns

A Type for the specified object.

Exceptions

instance is null.

Remarks

The GetReflectionType method is a low-level version of the GetTypeDescriptor method. GetReflectionType is typically used to perform standard reflection against an object when no custom type descriptor can be located for it.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

GetReflectionType(Type)

Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs
Source:
TypeDescriptor.cs

Returns a Type that can be used to perform reflection, given a class type.

C#
public static Type GetReflectionType(Type type);

Parameters

type
Type

The Type of the target component.

Returns

A Type of the specified class.

Exceptions

type is null.

Remarks

The GetReflectionType method is a low-level version of the GetTypeDescriptor method. GetReflectionType is typically used to perform standard reflection against a class when no custom type descriptor can be located for it.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1