DataColumn.ExtendedProperties プロパティ
DataColumn に関連付けられているカスタム ユーザー情報のコレクションを取得します。
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 プロパティを使用すると、カスタム情報をオブジェクトと共に格納できます。たとえば、データを更新する必要がある場合、時刻を格納できます。
拡張プロパティは、 String 型にする必要があります。 DataColumn が XML として書き込まれた場合、 String 型ではないプロパティは永続化されません。
使用例
[Visual Basic, C#, C++] ExtendedProperties プロパティによって返される PropertyCollection にカスタム プロパティを追加する例を次に示します。2 番目の例では、カスタム プロパティを取得します。
Private Sub SetProperty(myColumn As DataColumn)
myColumn.ExtendedProperties.Add("TimeStamp", DateTime.Now)
End Sub
Private Sub GetProperty(myColumn As DataColumn)
Console.WriteLine(myColumn.ExtendedProperties("TimeStamp").ToString())
End Sub
[C#]
private void SetProperty(DataColumn myColumn){
myColumn.ExtendedProperties.Add("TimeStamp", DateTime.Now);
}
private void GetProperty(DataColumn myColumn){
Console.WriteLine(myColumn.ExtendedProperties["TimeStamp"].ToString());
}
[C++]
private:
void SetProperty(DataColumn* myColumn){
myColumn->ExtendedProperties->Add(S"TimeStamp",__box(DateTime::Now));
}
void GetProperty(DataColumn* myColumn){
Console::WriteLine(myColumn->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
参照
DataColumn クラス | DataColumn メンバ | System.Data 名前空間 | PropertyCollection