CodeMemberFieldとは? わかりやすく解説

CodeMemberField クラス

型のフィールド宣言表します

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

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeMemberField
    Inherits CodeTypeMember
Dim instance As CodeMemberField
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeMemberField : CodeTypeMember
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeMemberField : public
 CodeTypeMember
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeMemberField extends CodeTypeMember
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeMemberField extends
 CodeTypeMember
解説解説

CodeMemberField使用して、型のフィールド宣言を表すことができます

使用例使用例

CodeMemberField使用して、型が stringtestStringField という名前のフィールド宣言する例を次に示します

' Declares a type to contain a field and a constructor method.
Dim type1 As New CodeTypeDeclaration("FieldTest")

' Declares a field of type String named testStringField.
Dim field1 As New CodeMemberField("System.String",
 "testStringField")
type1.Members.Add(field1)

' Declares an empty type constructor.
Dim constructor1 As New
 CodeConstructor()
constructor1.Attributes = MemberAttributes.Public
type1.Members.Add(constructor1)

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

' Public Class FieldTest
'
'     Private TestStringField As String
'
'     Public Sub New()
'         MyBase.New()
'     End Sub
'
' End Class

// Declares a type to contain a field and a constructor method.
CodeTypeDeclaration type1 = new CodeTypeDeclaration("FieldTest");

// Declares a field of type String named testStringField.
CodeMemberField field1 = new CodeMemberField("System.String"
,
 "TestStringField");
type1.Members.Add( field1 );

// Declares an empty type constructor.
CodeConstructor constructor1 = new CodeConstructor();
constructor1.Attributes = MemberAttributes.Public;            
type1.Members.Add( constructor1 );

// A C# code generator produces the following source code for the preceeding
 example code:

//    public class FieldTest 
//    {
//      private string testStringField;
//        
//        public FieldTest() 
//        {
//        }                            
//    }            
// Declares a type to contain a field and a constructor method.
CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "FieldTest" );

// Declares a field of type String named testStringField.
CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","TestStringField"
 );
type1->Members->Add( field1 );

// Declares an empty type constructor.
CodeConstructor^ constructor1 = gcnew CodeConstructor;
constructor1->Attributes = MemberAttributes::Public;
type1->Members->Add( constructor1 );

// A C# code generator produces the following source code for the preceeding
 example code:
//    public class FieldTest 
//    {
//      private string testStringField;
//        
//        public FieldTest() 
//        {
//        }                            
//    }            
// Declares a type to contain a field and a constructor method.
CodeTypeDeclaration type1 = new CodeTypeDeclaration("FieldTest");
// Declares a field of type String named testStringField.
CodeMemberField field1 = new CodeMemberField("System.String"
,
    "TestStringField");
type1.get_Members().Add(field1);
// Declares an empty type constructor.
CodeConstructor constructor1 = new CodeConstructor();
constructor1.set_Attributes(MemberAttributes.Public);
type1.get_Members().Add(constructor1);
// A VJ# code generator produces the following source code for the 
// preceeding example code:
//    public class FieldTest 
//    {
//        private String testStringField;
//        
//        public FieldTest() 
//        {
//        } //FieldTest                            
//    } //FieldTest           
' This example demonstrates declaring a public constant type member
 field.
' When declaring a public constant type member field, you must set a
 particular
' access and scope mask to the member attributes of the field in order
 for the
' code generator to properly generate the field as a constant field.
' Declares an integer field using a CodeMemberField
Dim constPublicField As New
 CodeMemberField(GetType(Integer), "testConstPublicField")

' Resets the access and scope mask bit flags of the member attributes
 of the field
' before setting the member attributes of the field to public and constant.
constPublicField.Attributes = constPublicField.Attributes And
 Not MemberAttributes.AccessMask And Not
 MemberAttributes.ScopeMask Or MemberAttributes.Public Or MemberAttributes.Const
// This example demonstrates declaring a public constant type member
 field.

// When declaring a public constant type member field, you must set
 a particular
// access and scope mask to the member attributes of the field in order
 for the
// code generator to properly generate the field as a constant field.

// Declares an integer field using a CodeMemberField
CodeMemberField constPublicField = new CodeMemberField(typeof(int),
 "testConstPublicField");

// Resets the access and scope mask bit flags of the member attributes
 of the field
// before setting the member attributes of the field to public and constant.
constPublicField.Attributes = (constPublicField.Attributes & ~MemberAttributes.AccessMask
 & ~MemberAttributes.ScopeMask) | MemberAttributes.Public | MemberAttributes.Const;
// This example demonstrates declaring a public constant type member
 field.

// When declaring a public constant type member field, you must set
 a particular
// access and scope mask to the member attributes of the field in order
 for the
// code generator to properly generate the field as a constant field.

// Declares an integer field using a CodeMemberField
CodeMemberField^ constPublicField = gcnew CodeMemberField( int::typeid,"testConstPublicField"
 );

// Resets the access and scope mask bit flags of the member attributes
 of the field
// before setting the member attributes of the field to public and constant.
constPublicField->Attributes = (MemberAttributes)((constPublicField->Attributes
 &  ~MemberAttributes::AccessMask &  ~MemberAttributes::ScopeMask) | MemberAttributes::Public
 | MemberAttributes::Const);
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeTypeMember
      System.CodeDom.CodeMemberField
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

CodeMemberField コンストラクタ ()


CodeMemberField コンストラクタ (CodeTypeReference, String)


CodeMemberField コンストラクタ


CodeMemberField コンストラクタ (String, String)


CodeMemberField コンストラクタ (Type, String)


CodeMemberField プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Attributes  メンバ属性取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ Comments  メンバコメント コレクション取得します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ CustomAttributes  メンバカスタム属性取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ EndDirectives  メンバ終了ディレクティブ取得します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ InitExpression フィールド初期化式を取得または設定します
パブリック プロパティ LinePragma  メンバステートメント発生する行を取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ Name  メンバの名前を取得または設定します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ StartDirectives  メンバ開始ディレクティブ取得します。 ( CodeTypeMember から継承されます。)
パブリック プロパティ Type フィールドデータ型取得または設定します
パブリック プロパティ UserData  現在のオブジェクトユーザー定義可能なデータ取得または設定します。 ( CodeObject から継承されます。)
参照参照

関連項目

CodeMemberField クラス
System.CodeDom 名前空間

CodeMemberField メソッド


CodeMemberField メンバ

型のフィールド宣言表します

CodeMemberField データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Attributes  メンバ属性取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ Comments  メンバコメント コレクション取得します。(CodeTypeMember から継承されます。)
パブリック プロパティ CustomAttributes  メンバカスタム属性取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ EndDirectives  メンバ終了ディレクティブ取得します。(CodeTypeMember から継承されます。)
パブリック プロパティ InitExpression フィールド初期化式を取得または設定します
パブリック プロパティ LinePragma  メンバステートメント発生する行を取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ Name  メンバの名前を取得または設定します。(CodeTypeMember から継承されます。)
パブリック プロパティ StartDirectives  メンバ開始ディレクティブ取得します。(CodeTypeMember から継承されます。)
パブリック プロパティ Type フィールドデータ型取得または設定します
パブリック プロパティ UserData  現在のオブジェクトユーザー定義可能なデータ取得または設定します。(CodeObject から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CodeMemberField クラス
System.CodeDom 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からCodeMemberFieldを検索した結果を表示しています。
Weblioに収録されているすべての辞書からCodeMemberFieldを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からCodeMemberField を検索

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

辞書ショートカット

すべての辞書の索引

「CodeMemberField」の関連用語

CodeMemberFieldのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS