CodeCastExpression クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class CodeCastExpression Inherits CodeExpression
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class CodeCastExpression : CodeExpression
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class CodeCastExpression : public CodeExpression

CodeCastExpression を使用して、別のデータ型またはインターフェイスにキャストする式を表すことができます。
Expression プロパティは、キャストする CodeExpression を示します。TargetType プロパティは、キャスト先の型を示します。

CodeCastExpression を使用して、System.Int32 の値を System.Int64 のデータ型にキャストする例を次に示します。
' 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)
// This CodeCastExpression casts an Int32 of 1000 to an Int64. CodeCastExpression castExpression = new CodeCastExpression( // targetType parameter indicating the target type of the cast. "System.Int64", // The CodeExpression to cast, here an Int32 value of 1000. new CodePrimitiveExpression(1000) ); // A C# code generator produces the following source code for the preceeding example code: // ((long)(1000));
// This CodeCastExpression casts an Int32 of 1000 to an Int64. // targetType parameter indicating the target type of the cast. // The CodeExpression to cast, here an Int32 value of 1000. CodeCastExpression^ castExpression = gcnew CodeCastExpression( "System.Int64",gcnew CodePrimitiveExpression( 1000 ) ); // A C# code generator produces the following source code for the preceeding example code: // ((long)(1000));
// This CodeCastExpression casts an Int32 of 1000 to an Int64. CodeCastExpression castExpression = new CodeCastExpression( // targetType parameter indicating the target type of the cast. "System.Int64", // The CodeExpression to cast, here an Int32 value of 1000. new CodePrimitiveExpression(System.Convert.ToString(1000))); // A VJ# code generator produces the following source code for // the preceeding example code: // (System.Convert.ToInt64(1000));

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


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- CodeCastExpression クラスのページへのリンク