Dela via


EnterpriseManagementObjectBaseWithProperties.TryGetProperty Method (ManagementPackType, String, out EnterpriseManagementSimpleObject)

Gets a property value by name and type if one exists

Namespace: Microsoft.EnterpriseManagement.Common
Assembly: Microsoft.EnterpriseManagement.Core (in microsoft.enterprisemanagement.core.dll)

Usage

'Usage
Dim instance As EnterpriseManagementObjectBaseWithProperties
Dim type As ManagementPackType
Dim name As String
Dim simpleObject As EnterpriseManagementSimpleObject
Dim returnValue As Boolean

returnValue = instance.TryGetProperty(type, name, simpleObject)

Syntax

'Declaration
Public Function TryGetProperty ( _
    type As ManagementPackType, _
    name As String, _
    <OutAttribute> ByRef simpleObject As EnterpriseManagementSimpleObject _
) As Boolean
public bool TryGetProperty (
    ManagementPackType type,
    string name,
    out EnterpriseManagementSimpleObject simpleObject
)
public:
bool TryGetProperty (
    ManagementPackType^ type, 
    String^ name, 
    [OutAttribute] EnterpriseManagementSimpleObject^% simpleObject
)
public boolean TryGetProperty (
    ManagementPackType type, 
    String name, 
    /** @attribute OutAttribute() */ /** @ref */ EnterpriseManagementSimpleObject simpleObject
)

Parameters

  • type
    The type to search.
  • name
    The name of the property
  • simpleObject
    When this method returns, contains the property value. This parameter is passed uninitialized.

Return Value

true if the property was found and returned; otherwise, false.

Exceptions

Exception type Condition
ArgumentNullException

The name parameter is a null reference (Nothing in Visual Basic).

ArgumentException

The property doesn’t exist.

ObjectNotUniqueException

More than one property matched the name and type.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

Windows Server 2008,Windows Server 2003

See Also

Reference

EnterpriseManagementObjectBaseWithProperties Class
EnterpriseManagementObjectBaseWithProperties Members
Microsoft.EnterpriseManagement.Common Namespace