This documentation is archived and is not being maintained.

PropertyDataCollection.Item Property

Gets the specified property from the PropertyDataCollection, using [] syntax. This property is the indexer for the PropertyDataCollection class.

Namespace: System.Management
Assembly: System.Management (in system.management.dll)

public virtual PropertyData this [
	string propertyName
] { get; }
/** @property */
public PropertyData get_Item (String propertyName)

Not applicable.

Parameters

propertyName

The name of the property to retrieve.

Property Value

Returns a PropertyData containing the data for a specified property in the collection.

Property Value

A PropertyData, based on the name specified.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

The following example gets the Freespace property from a 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");
    }
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: