BigInteger.TryParse Method

Definition

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

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 convert a span of characters to a BigInteger using the specified format provider.
TryParse(String, IFormatProvider, BigInteger)Tries to convert a string to a BigInteger using the specified format provider.
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, BigInteger)Tries to convert a span of characters to a BigInteger using the specified style and format provider.
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 convert a span of characters to a BigInteger using the specified format provider.
C#
public static bool TryParse(
	ReadOnlySpan<char> s,
	IFormatProvider? provider,
	out BigInteger result
)

Parameters

s  ReadOnlySpan<Char>
The characters to convert.
provider  IFormatProvider
An object that supplies culture-specific formatting information.
result  BigInteger
On success, receives the converted value.

Return Value

Boolean
true if the conversion succeeds; otherwise, false.

Implements

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

TryParse(String, IFormatProvider, BigInteger)

Tries to convert a string to a BigInteger using the specified format provider.
C#
public static bool TryParse(
	string s,
	IFormatProvider? provider,
	out BigInteger result
)

Parameters

s  String
The string to convert.
provider  IFormatProvider
An object that supplies culture-specific formatting information.
result  BigInteger
On success, receives the converted value.

Return Value

Boolean
true if the conversion succeeds; otherwise, false.

Implements

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

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

Tries to convert a span of characters to a BigInteger using the specified style and format provider.
C#
public static bool TryParse(
	ReadOnlySpan<char> s,
	NumberStyles style,
	IFormatProvider? provider,
	out BigInteger result
)

Parameters

s  ReadOnlySpan<Char>
The characters to convert.
style  NumberStyles
The permitted number styles.
provider  IFormatProvider
An object that supplies culture-specific formatting information.
result  BigInteger
On success, receives the converted value.

Return Value

Boolean
true if the conversion succeeds; otherwise, false.

Implements

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

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