PSConsoleReadLine.TryGetArgAsInt(Object, Int32, Int32) Method

Definition

A helper method when your function expects an optional int argument (e.g. from DigitArgument) If there is not argument (it's null), returns true and sets numericArg to defaultNumericArg. Dings and returns false if the argument is not an int (no conversion is attempted) Otherwise returns true, and numericArg has the result.

public:
 static bool TryGetArgAsInt(System::Object ^ arg, [Runtime::InteropServices::Out] int % numericArg, int defaultNumericArg);
 static bool TryGetArgAsInt(winrt::Windows::Foundation::IInspectable const & arg, [Runtime::InteropServices::Out] int & numericArg, int defaultNumericArg);
public static bool TryGetArgAsInt (object arg, out int numericArg, int defaultNumericArg);
static member TryGetArgAsInt : obj * int * int -> bool
Public Shared Function TryGetArgAsInt (arg As Object, ByRef numericArg As Integer, defaultNumericArg As Integer) As Boolean

Parameters

arg
Object
numericArg
Int32
defaultNumericArg
Int32

Returns

Applies to