This documentation is archived and is not being maintained.

PropertyDataCollection.Item Property

Returns the specified property from the PropertyDataCollection, using [] syntax.

[C#] In C#, this property is the indexer for the PropertyDataCollection class.

[Visual Basic]
Public Overridable Default ReadOnly Property Item( _
   ByVal propertyName As String _
) As PropertyData
[C#]
public virtual PropertyData this[
 string propertyName
] {get;}
[C++]
public: __property virtual PropertyData* get_Item(
 String* propertyName
);
[JScript]
returnValue = PropertyDataCollectionObject.Item(propertyName);
-or-
returnValue = PropertyDataCollectionObject(propertyName);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.

Arguments [JScript]

propertyName
The name of the property to retrieve.

Parameters [Visual Basic, C#, C++]

propertyName
The name of the property to retrieve.

Property Value

A PropertyData, based on the name specified.

Example

[C#] 
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] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

PropertyDataCollection Class | PropertyDataCollection Members | System.Management Namespace

Show: