PSObjectExtensions.TryGetProperty Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryGetProperty(PSObject, String, Object) |
Try to return the value of the given property from the given PSObject |
TryGetProperty<T>(PSObject, String, T) |
Try to return the value of the given property from the given PSObject |
TryGetProperty(PSObject, String, Object)
Try to return the value of the given property from the given PSObject
public static bool TryGetProperty (this System.Management.Automation.PSObject source, string name, out object propertyValue);
static member TryGetProperty : System.Management.Automation.PSObject * string * obj -> bool
<Extension()>
Public Function TryGetProperty (source As PSObject, name As String, ByRef propertyValue As Object) As Boolean
Parameters
- source
- PSObject
The PSObject to retrieve the property from
- name
- String
The name of the property to retrieve
- propertyValue
- Object
The value of the property, if found in the given PSObject
Returns
True if the property was found, otherwise false
Applies to
TryGetProperty<T>(PSObject, String, T)
Try to return the value of the given property from the given PSObject
public static bool TryGetProperty<T> (this System.Management.Automation.PSObject source, string name, out T propertyValue);
static member TryGetProperty : System.Management.Automation.PSObject * string * 'T -> bool
<Extension()>
Public Function TryGetProperty(Of T) (source As PSObject, name As String, ByRef propertyValue As T) As Boolean
Type Parameters
- T
The expected type of the property
Parameters
- source
- PSObject
The PSObject to retrieve the property from
- name
- String
The name of the property to retrieve
- propertyValue
- T
The value of the property, if found in the given PSObject
Returns
True if the property was found, otherwise false