CodeCastExpression クラスとは? わかりやすく解説

CodeCastExpression クラス

データ型またはインターフェイスキャストする式を表します

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeCastExpression
    Inherits CodeExpression
Dim instance As CodeCastExpression
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeCastExpression : CodeExpression
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeCastExpression : public
 CodeExpression
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeCastExpression extends CodeExpression
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeCastExpression extends
 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.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeExpression
      System.CodeDom.CodeCastExpression
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CodeCastExpression メンバ
System.CodeDom 名前空間
CodeExpression



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeCastExpression クラス」の関連用語

CodeCastExpression クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeCastExpression クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS