PropertyDataCollection.Item[String] 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用 [] 語法從 PropertyDataCollection取得指定的屬性。 這個屬性就是該 PropertyDataCollection 類別的索引器。
public:
virtual property System::Management::PropertyData ^ default[System::String ^] { System::Management::PropertyData ^ get(System::String ^ propertyName); };
public virtual System.Management.PropertyData this[string propertyName] { get; }
member this.Item(string) : System.Management.PropertyData
Default Public Overridable ReadOnly Property Item(propertyName As String) As PropertyData
參數
- propertyName
- String
要取回的房產名稱。
屬性值
回傳 PropertyData 包含集合中指定屬性的資料。
範例
以下範例可從 取得ManagementClass性質。
using System;
using System.Management;
public class Sample
{
public static void Main(string[] args)
{
ManagementObject m = new ManagementObject(
"Win32_LogicalDisk.DeviceID=\"C:\"");
Console.WriteLine("Free space on drive C is: " +
m.Properties["Freespace"].Value + " bytes");
}
}
Imports System.Management
Class Sample_ManagementClass
Public Overloads Shared Function Main( _
ByVal args() As String) As Integer
Dim m As New ManagementObject( _
"Win32_LogicalDisk.DeviceID=""C:""")
Console.WriteLine( _
m.Properties("FreeSpace").Value)
Return 0
End Function
End Class
備註
屬性值
根據指定名稱,A PropertyData,
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。