TypeExt.ThrowIfCannotCastTo Method

Throws an InvalidCastException if the type defined by self can’t be casted to the type defined by [!:to].

Namespace: UltimateXR.Extensions.System
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static void ThrowIfCannotCastTo(
	this Type self,
	Type to
)

Parameters

 

self
Type: System.Type
Source type
to
Type: System.Type
Destination type

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ExceptionCondition
InvalidCastExceptionThrown when the source type can’t be casted to the destination type

See Also

Reference

TypeExt Class
UltimateXR.Extensions.System Namespace