次の方法で共有


DataTable.ExtendedProperties プロパティ

カスタマイズされたユーザー情報のコレクションを取得します。

Public ReadOnly Property ExtendedProperties As PropertyCollection
[C#]
public PropertyCollection ExtendedProperties {get;}
[C++]
public: __property PropertyCollection* get_ExtendedProperties();
[JScript]
public function get ExtendedProperties() : PropertyCollection;

プロパティ値

カスタム ユーザー情報が格納された PropertyCollection

解説

ExtendedProperties プロパティを使用して、カスタム情報を DataTable に追加します。Add メソッドで情報を追加します。Item メソッドで情報を取得します。

拡張プロパティは、 String 型にする必要があります。 DataTable が XML として書き込まれた場合、文字列型ではないプロパティは永続化されません。

使用例

[Visual Basic, C#, C++] ExtendedProperties プロパティを使用して、タイムスタンプ値を DataTable に追加する例を次に示します。

 
Private Sub GetAndSetExtendedProperties(ByVal myTable As DataTable)
   ' Add an item to the collection.
   myTable.ExtendedProperties.Add("TimeStamp", DateTime.Now)
   ' Print the item.
   Console.WriteLine(myTable.ExtendedProperties.Item("TimeStamp"))
End Sub

[C#] 
private void GetAndSetExtendedProperties(DataTable myTable){
   // Add an item to the collection.
   myTable.ExtendedProperties.Add("TimeStamp", DateTime.Now);
   // Print the item.
   Console.WriteLine(myTable.ExtendedProperties["TimeStamp"]);
}

[C++] 
private:
 void GetAndSetExtendedProperties(DataTable* myTable){
    // Add an item to the collection.
    myTable->ExtendedProperties->Add(S"TimeStamp",__box(DateTime::Now));
    // Print the item.
    Console::WriteLine(myTable->ExtendedProperties->Item[S"TimeStamp"]);
 }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

DataTable クラス | DataTable メンバ | System.Data 名前空間