Gets access to property values through [] notation. This property is the indexer for the ManagementBaseObject class. 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.
Assembly: System.Management (in System.Management.dll)
Public Property Item ( _ propertyName As String _ ) As Object Get Set
public Object this[ string propertyName ] { get; set; }
public: property Object^ Item[String^ propertyName] { Object^ get (String^ propertyName); void set (String^ propertyName, Object^ value); }
member Item : Object with get, set
Parameters
- propertyName
- Type: System.String
The name of the property of interest.
Property Value
Type: System.ObjectReturns an Object value that contains the management object for a specific class property.
Property Value
An object instance that contains the value of the requested property.
.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 shows how to initialize a ManagementClass variable with a ManagementClass constructor and then get all the instances of a WMI class.
Imports System Imports System.Management Class Sample Public Overloads Shared Function _ Main(ByVal args() As String) As Integer Dim c As New ManagementClass("Win32_Process") Dim o As ManagementObject For Each o In c.GetInstances() Console.WriteLine( _ "Next instance of Win32_Process : {0}", o("Name")) Next o End Function End Class
using System; using System.Management; public class Sample { public static void Main() { ManagementClass c = new ManagementClass("Win32_Process"); foreach (ManagementObject o in c.GetInstances()) Console.WriteLine( "Next instance of Win32_Process : {0}", o["Name"]); } }
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0.NET Framework Client Profile
Supported in: 4, 3.5 SP1- 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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.