次の方法で共有


PropertyDataCollection.Item プロパティ

[] 構文を使用して、指定したプロパティを PropertyDataCollection から返します。

[C#] C# では、このプロパティは PropertyDataCollection クラスのインデクサになります。

Public Overridable Default ReadOnly Property Item( _
   ByVal propertyName As String _) As PropertyData
[C#]
public virtual PropertyData this[stringpropertyName] {get;}
[C++]
public: __property virtual PropertyData* get_Item(String* propertyName);
[JScript]
returnValue = PropertyDataCollectionObject.Item(propertyName);またはreturnValue = PropertyDataCollectionObject(propertyName);

[JScript] JScript では、この型で定義されている既定のインデックス プロパティを使用することができます。しかし、独自のインデックス プロパティを明示的に定義することはできません。ただし、このクラスの expando 属性を指定すると、既定のインデックス プロパティが提供されます。提供されるインデックス プロパティの型は Object 型であり、インデックス型は String になります。

引数 [JScript]

  • propertyName
    取得するプロパティの名前。

パラメータ [Visual Basic, C#, C++]

  • propertyName
    取得するプロパティの名前。

プロパティ値

指定した名前に基づく PropertyData

使用例

 
ManagementObject o = new ManagementObject("Win32_LogicalDisk.Name = 'C:'");
Console.WriteLine("Free space on C: drive is: ", c.Properties["FreeSpace"].Value);
   
[Visual Basic] 
Dim o As New ManagementObject("Win32_LogicalDisk.Name=""C:""")
Console.WriteLine("Free space on C: drive is: " & c.Properties("FreeSpace").Value)
   

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

必要条件

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

.NET Framework セキュリティ:

参照

PropertyDataCollection クラス | PropertyDataCollection メンバ | System.Management 名前空間