mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
add tryparse for short, ushort, long, and ulong
This commit is contained in:
parent
2f1f19c3ff
commit
0b05a87653
1 changed files with 48 additions and 0 deletions
|
|
@ -191,6 +191,54 @@ namespace ICD.Common.Utils
|
|||
return TryConvert(Convert.ToUInt32, value, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the string as a short integer.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
[PublicAPI]
|
||||
public static bool TryParse(string value, out short result)
|
||||
{
|
||||
return TryConvert(Convert.ToInt16, value, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the string as an unsigned short integer.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
[PublicAPI]
|
||||
public static bool TryParse(string value, out ushort result)
|
||||
{
|
||||
return TryConvert(Convert.ToUInt16, value, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the string as a long integer.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
[PublicAPI]
|
||||
public static bool TryParse(string value, out long result)
|
||||
{
|
||||
return TryConvert(Convert.ToInt64, value, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the string as an unsigned long integer.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
[PublicAPI]
|
||||
public static bool TryParse(string value, out ulong result)
|
||||
{
|
||||
return TryConvert(Convert.ToUInt64, value, out result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the string as a float.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue