New to Telerik UI for BlazorStart a free 30-day trial

Extension methods for working with types

Definition

Namespace:Telerik.DataSource.Extensions

Assembly:Telerik.DataSource.dll

Syntax:

C#
public static class TypeExtensions

Inheritance: objectTypeExtensions

Methods

Returns the default value of the given type

C#
public static object DefaultValue(this Type type)
Parameters:typeTypeReturns:

object

Returns the non-nullable type for the type that is passed.

C#
public static Type GetNonNullableType(this Type type)
Parameters:typeTypeReturns:

Type

Returns the name of the type as a string

C#
public static string GetTypeName(this Type type)
Parameters:typeTypeReturns:

string

Returns true if the source can be assigned to the target

C#
public static bool IsCompatibleWith(this Type source, Type target)
Parameters:sourceTypetargetTypeReturns:

bool

Returns true if the object is dynamic

C#
public static bool IsDynamicObject(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is an enumeration

C#
public static bool IsEnumType(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is generic

C#
public static bool IsGenericType(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is an interface

C#
public static bool IsInterface(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is nullable

C#
public static bool IsNullableType(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is a number type

C#
public static bool IsNumericType(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the object is plain (that is, not dynamic)

C#
public static bool IsPlainType(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is one of the standard .NET types

C#
public static bool IsPredefinedType(this Type type)
Parameters:typeTypeReturns:

bool

Returns true if the type is a Value type

C#
public static bool IsValueType(this Type type)
Parameters:typeTypeReturns:

bool