CodeCastExpression Class

 

Represents an expression cast to a data type or interface.

Namespace:   System.CodeDom
Assembly:  System (in System.dll)

System.Object
  System.CodeDom.CodeObject
    System.CodeDom.CodeExpression
      System.CodeDom.CodeCastExpression

<SerializableAttribute>
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)>
<ComVisibleAttribute(True)>
Public Class CodeCastExpression
	Inherits CodeExpression

NameDescription
System_CAPS_pubmethodCodeCastExpression()

Initializes a new instance of the CodeCastExpression class.

System_CAPS_pubmethodCodeCastExpression(CodeTypeReference, CodeExpression)

Initializes a new instance of the CodeCastExpression class using the specified destination type and expression.

System_CAPS_pubmethodCodeCastExpression(String, CodeExpression)

Initializes a new instance of the CodeCastExpression class using the specified destination type and expression.

System_CAPS_pubmethodCodeCastExpression(Type, CodeExpression)

Initializes a new instance of the CodeCastExpression class using the specified destination type and expression.

NameDescription
System_CAPS_pubpropertyExpression

Gets or sets the expression to cast.

System_CAPS_pubpropertyTargetType

Gets or sets the destination type of the cast.

System_CAPS_pubpropertyUserData

Gets the user-definable data for the current object.(Inherited from CodeObject.)

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

CodeCastExpression can be used to represent an expression cast to a different data type or interface.

The Expression property indicates the CodeExpression to cast. The TargetType property indicates the type to cast to.

This example demonstrates using a CodeCastExpression to cast a System.Int32 value to a System.Int64 data type.

' This CodeCastExpression casts an Int32 of 1000 to an Int64.		
Dim castExpression As New CodeCastExpression( _
    "System.Int64", New CodePrimitiveExpression(1000) )

' A Visual Basic code generator produces the following source code for the preceeding example code:

' CType(1000,Long)

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: