CodeTypeDeclaration.IsPartial プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CodeTypeDeclaration.IsPartial プロパティの意味・解説 

CodeTypeDeclaration.IsPartial プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

宣言が完全か部分的かを示す値を取得または設定します

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

Dim instance As CodeTypeDeclaration
Dim value As Boolean

value = instance.IsPartial

instance.IsPartial = value
public bool IsPartial { get;
 set; }
/** @property */
public boolean get_IsPartial ()

/** @property */
public void set_IsPartial (boolean value)

プロパティ
クラス宣言または構造体宣言部分的な実装表現である場合は、true。これらの宣言クラスまたは構造体の完全な実装である場合は、false既定値false です。

解説解説

1 つ宣言内に完結するクラスまたは構造体実装作成することも、複数宣言わたって実装することもできます実装は、通常1 つの完全な型宣言提供されます。この場合、型宣言IsPartial プロパティfalse設定します。この値は、型宣言クラスまたは構造体実装の詳細を完全に表すことを示します

部分的な宣言使用すると、アプリケーション各種モジュールで、クラスまたは構造体実装さまざまな部分簡単に作成できます部分的な宣言は、1 つソース ファイル保存することも、複数ソース ファイルわたって保存することもできます。ただし、これらの複数ファイルは、最終的にまとめてコンパイルし、結合して実装形成する必要があります

C# 言語では、partial キーワードによって、クラス構造体部分的な宣言サポートされます。Visual Basic では、Partial キーワードによって、クラス構造体部分的な宣言サポートされます。部分的な宣言サポートされないコード ジェネレータもあるので、PartialTypes フラグ指定して Supports メソッド呼び出し、このサポートテストします

メモメモ

部分的な宣言は、クラス構造体についてサポートされます。列挙体やインターフェイス部分的な宣言指定すると、生成されコードコンパイラ エラー発生します

複数宣言わたってクラスまたは構造体実装提供する場合最初宣言すべての補足宣言について IsPartial プロパティtrue設定します最初宣言では、アクセス修飾子継承された型、実装されたインターフェイスを含む型シグネチャを完全に指定する必要があります補足宣言で、型シグネチャを再指定する要はありません。コンパイラ エラーは、通常補足宣言で型シグネチャを再定義すると、発生します

Visual Studio 2005 は、ユーザー生成したコードデザイナ コード区別するために部分的な型を使用しますVisual Basic Windows アプリケーション プロジェクトでは、ユーザー コードPartial キーワードで修飾されていない部分クラス配置されデザイナ提供したコードPartial キーワードを持つクラス表示されます。C# では、ユーザー コードデザイナ コード両方が、partial キーワードで識別される部分クラス表示されます。

使用例使用例

この例は、CodeTypeDeclaration を使用して複数宣言にわたるクラス実装提供するコード例です。この例では、最初クラス宣言ステートメント作成しIsPartial プロパティtrue設定します

Dim baseClass As CodeTypeDeclaration = New
 CodeTypeDeclaration("DocumentProperties")
baseClass.IsPartial = True
baseClass.IsClass = True
baseClass.Attributes = MemberAttributes.Public
baseClass.BaseTypes.Add(New CodeTypeReference(GetType(System.Object)))

' Add the DocumentProperties class to the namespace.
sampleSpace.Types.Add(baseClass)
            CodeTypeDeclaration baseClass = new CodeTypeDeclaration("DocumentProperties");
            baseClass.IsPartial = true;
            baseClass.IsClass = true;
            baseClass.Attributes = MemberAttributes.Public;
            baseClass.BaseTypes.Add(new CodeTypeReference(typeof(System.Object
)));

            // Add the DocumentProperties class to the namespace.
            sampleSpace.Types.Add(baseClass);
CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties"
 );
baseClass->IsPartial = true;
baseClass->IsClass = true;
baseClass->Attributes = MemberAttributes::Public;
baseClass->BaseTypes->Add( gcnew CodeTypeReference( System::Object::typeid
 ) );

// Add the DocumentProperties class to the namespace.
sampleSpace->Types->Add( baseClass );

この例の別のメソッドによって、クラス実装拡張されます。このメソッドでは、既存クラスに対して新しい型宣言ステートメント作成しIsPartial プロパティtrue設定しますコンパイラによって、2 つ部分的な宣言結合され、完全なクラス実装作成されます。

Dim baseClass As CodeTypeDeclaration = New
 CodeTypeDeclaration("DocumentProperties")
baseClass.IsPartial = True
baseClass.IsClass = True
baseClass.Attributes = MemberAttributes.Public

' Extend the DocumentProperties class in the unit namespace.
docPropUnit.Namespaces(0).Types.Add(baseClass)
CodeTypeDeclaration baseClass = new CodeTypeDeclaration("DocumentProperties");
baseClass.IsPartial = true;
baseClass.IsClass = true;
baseClass.Attributes = MemberAttributes.Public;

// Extend the DocumentProperties class in the unit namespace.
docPropUnit.Namespaces[0].Types.Add(baseClass);
CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties"
 );
baseClass->IsPartial = true;
baseClass->IsClass = true;
baseClass->Attributes = MemberAttributes::Public;

// Extend the DocumentProperties class in the unit namespace.
( *docPropUnit)->Namespaces[ 0 ]->Types->Add( baseClass );
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CodeTypeDeclaration クラス
CodeTypeDeclaration メンバ
System.CodeDom 名前空間
PartialTypes


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

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

辞書ショートカット

すべての辞書の索引

CodeTypeDeclaration.IsPartial プロパティのお隣キーワード
検索ランキング

   

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



CodeTypeDeclaration.IsPartial プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS