Skip to content

IStringParameterExtensions Class#

Extension class for the string parameter interface.

Inheritance Hierarchy#

System.Object
  Basler.Pylon.IStringParameterExtensions

Syntax#

C#

public static class IStringParameterExtensions

VB

<ExtensionAttribute>
Public NotInheritable Class IStringParameterExtensions

The IStringParameterExtensions 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 memberTrySetValue Sets the provided value if the parameter is writable.
 

IStringParameterExtensions.GetValueOrDefault Method#

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

Syntax#

C#

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

VB

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

Parameters#
parameter
Type: Basler.Pylon.IStringParameter
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 IStringParameter. 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.

IStringParameterExtensions.TrySetValue Method#

Sets the provided value if the parameter is writable.

Syntax#

C#

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

VB

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

Parameters#
parameter
Type: Basler.Pylon.IStringParameter
The interface of the parameter.
value
Type: System.String
The string value 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 IStringParameter. 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 length of the string must be less than GetMaxLength().

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.