Skip to content

IEnumParameterExtensions Class#

Extension class for the enumeration parameter interface.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.IEnumParameterExtensions

Syntax#

C#

public static class IEnumParameterExtensions

VB

<ExtensionAttribute>
Public NotInheritable Class IEnumParameterExtensions

The IEnumParameterExtensions type exposes the following members.

Methods#

 NameDescription
Public methodStatic memberGetValueOrDefault Gets the parameter value if the parameter is readable. Otherwise, returns the default value.
Public methodStatic memberSetValue Sets the first valid value from a list of values.
Public methodStatic memberTrySetValue(IEnumParameter, IEnumerable<(Of <<'(String>)>>)) Sets the first valid value from a list of values if the parameter is writable.
Public methodStatic memberTrySetValue(IEnumParameter, String) Sets the value passed if the parameter is writable and the value is contained in the set of settable enumeration values.
 

IEnumParameterExtensions.GetValueOrDefault Method#

Gets the parameter value if the parameter is readable. Otherwise, returns the default value.

Syntax#

C#

public static string GetValueOrDefault(
    this IEnumParameter parameter,
    string defaultValue
)

VB

<ExtensionAttribute>
Public Shared Function GetValueOrDefault ( 
    parameter As IEnumParameter,
    defaultValue As String
) As String

Parameters#
parameter
Type: Basler.Pylon.IEnumParameter
The interface of the parameter.
defaultValue
Type: System.String
The default value returned if the parameter is not readable.
Return Value#

Type: String
Returns the parameter value if the parameter is readable. Otherwise, returns the default value.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumParameter. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks#

Thread Safety: This method is synchronized with the source of the parameter collection, if any.

Error Safety: Can throw exceptions if reading the value fails.

IEnumParameterExtensions.SetValue Method#

Sets the first valid value from a list of values.

Syntax#

C#

public static void SetValue(
    this IEnumParameter parameter,
    IEnumerable<string> values
)

VB

<ExtensionAttribute>
Public Shared Sub SetValue ( 
    parameter As IEnumParameter,
    values As IEnumerable(Of String)
)

Parameters#
parameter
Type: Basler.Pylon.IEnumParameter
The interface of the parameter.
values
Type: System.Collections.Generic.IEnumerable(String)
The list of possible values to set.
Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumParameter. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks#

Preconditions:
 

  • The parameter must be writable.
  • At least one value contained in the list passed must be contained in the set of settable enumeration values.

Thread Safety: This method is synchronized with the source of the parameter collection, if any.

Error Safety: Can throw exceptions if the parameter is not writable, no value is valid, or writing the value fails.

IEnumParameterExtensions.TrySetValue Method (IEnumParameter, IEnumerable(String))#

Sets the first valid value from a list of values if the parameter is writable.

Syntax#

C#

public static bool TrySetValue(
    this IEnumParameter parameter,
    IEnumerable<string> values
)

VB

<ExtensionAttribute>
Public Shared Function TrySetValue ( 
    parameter As IEnumParameter,
    values As IEnumerable(Of String)
) As Boolean

Parameters#
parameter
Type: Basler.Pylon.IEnumParameter
The interface of the parameter.
values
Type: System.Collections.Generic.IEnumerable(String)
The list of possible values to set.
Return Value#

Type: Boolean
Returns false if the parameter is not writable.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumParameter. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks#

Preconditions: At least one value contained in the passed list must be contained in the set of settable enumeration values.

Thread Safety: This method is synchronized with the source of the parameter collection, if any.

Error Safety: Can throw exceptions if the parameter is not writable, no value is valid, or writing the value fails.

IEnumParameterExtensions.TrySetValue Method (IEnumParameter, String)#

Sets the value passed if the parameter is writable and the value is contained in the set of settable enumeration values.

Syntax#

C#

public static bool TrySetValue(
    this IEnumParameter parameter,
    string value
)

VB

<ExtensionAttribute>
Public Shared Function TrySetValue ( 
    parameter As IEnumParameter,
    value As String
) As Boolean

Parameters#
parameter
Type: Basler.Pylon.IEnumParameter
The interface of the parameter.
value
Type: System.String
The value to set.
Return Value#

Type: Boolean
Returns false if the parameter is not writable or the value is not contained in the set of settable enumeration values.

Usage Note#

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumParameter. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks#

Thread Safety: This method is synchronized with the source of the parameter collection, if any.

Error Safety: Can throw exceptions if the preconditions are not met or if writing the value fails.

IEnumParameterExtensions.TrySetValue Method#

Overload List#

 NameDescription
Public methodStatic memberTrySetValue(IEnumParameter, IEnumerable<(Of <<'(String>)>>)) Sets the first valid value from a list of values if the parameter is writable.
Public methodStatic memberTrySetValue(IEnumParameter, String) Sets the value passed if the parameter is writable and the value is contained in the set of settable enumeration values.