BigInteger.TryParse Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

TryParse(String, BigInteger) Converts the string representation of a number to its BigInteger equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(ReadOnlySpan<Char>, IFormatProvider, BigInteger)Tries to parse a span of characters into a value.
TryParse(String, IFormatProvider, BigInteger)Tries to parse a string into a value.
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, BigInteger)Tries to parse a span of characters into a value.
TryParse(String, NumberStyles, IFormatProvider, BigInteger) Converts the string representation of a number in a specified style and culture-specific format to its BigInteger equivalent. A return value indicates whether the conversion succeeded or failed.

TryParse(String, BigInteger)

Converts the string representation of a number to its BigInteger equivalent. A return value indicates whether the conversion succeeded or failed.
C#
public static bool TryParse(
	string s,
	out BigInteger value
)

Parameters

s  String
A string containing a number to convert.
value  BigInteger
When this method returns, contains the BigInteger equivalent to the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null, or is not of the correct format., This parameter is passed uninitialized.

Return Value

Boolean
true if s was converted successfully; otherwise, false.

TryParse(ReadOnlySpan<Char>, IFormatProvider, BigInteger)

Tries to parse a span of characters into a value.
C#
public static bool TryParse(
	ReadOnlySpan<char> s,
	IFormatProvider? provider,
	out BigInteger result
)

Parameters

s  ReadOnlySpan<Char>
The span of characters to parse.
provider  IFormatProvider
An object that provides culture-specific formatting information about s.
result  BigInteger
When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Return Value

Boolean
true if s was successfully parsed; otherwise, false.

Implements

ISpanParsable<TSelf>.TryParse(ReadOnlySpan<Char>, IFormatProvider, TSelf)

TryParse(String, IFormatProvider, BigInteger)

Tries to parse a string into a value.
C#
public static bool TryParse(
	string s,
	IFormatProvider? provider,
	out BigInteger result
)

Parameters

s  String
The string to parse.
provider  IFormatProvider
An object that provides culture-specific formatting information about s.
result  BigInteger
When this method returns, contains the result of successfully parsing s or an undefined value on failure.

Return Value

Boolean
true if s was successfully parsed; otherwise, false.

Implements

IParsable<TSelf>.TryParse(String, IFormatProvider, TSelf)

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, BigInteger)

Tries to parse a span of characters into a value.
C#
public static bool TryParse(
	ReadOnlySpan<char> s,
	NumberStyles style,
	IFormatProvider? provider,
	out BigInteger result
)

Parameters

s  ReadOnlySpan<Char>
The span of characters to parse.
style  NumberStyles
A bitwise combination of number styles that can be present in s.
provider  IFormatProvider
An object that provides culture-specific formatting information about s.
result  BigInteger
On return, contains the result of succesfully parsing s or an undefined value on failure.

Return Value

Boolean
true if s was successfully parsed; otherwise, false.

Implements

INumberBase<TSelf>.TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf)

Exceptions

ArgumentExceptionstyle is not a supported NumberStyles value.

TryParse(String, NumberStyles, IFormatProvider, BigInteger)

Converts the string representation of a number in a specified style and culture-specific format to its BigInteger equivalent. A return value indicates whether the conversion succeeded or failed.
C#
public static bool TryParse(
	string s,
	NumberStyles style,
	IFormatProvider? provider,
	out BigInteger value
)

Parameters

s  String
A string containing a number to convert.
style  NumberStyles
A bitwise combination of NumberStyles values that indicates the permitted format of s.
provider  IFormatProvider
An IFormatProvider that supplies culture-specific formatting information about s.
value  BigInteger
When this method returns, contains the BigInteger equivalent to the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null, or is not of the correct format., This parameter is passed uninitialized.

Return Value

Boolean
true if s was converted successfully; otherwise, false.

Implements

INumberBase<TSelf>.TryParse(String, NumberStyles, IFormatProvider, TSelf)

Exceptions

ArgumentExceptionstyle is not a NumberStyles value.

-or-

style is not a combination of AllowHexSpecifier and HexNumber values.

See Also