Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 12f6102

Browse files
committed
Add ToLong overloads
1 parent 4de0db7 commit 12f6102

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,10 @@ public static bool IsSystemType(this Type type)
10341034

10351035
public static int ToInt(this string text, int defaultValue) => int.TryParse(text, out var ret) ? ret : defaultValue;
10361036

1037+
public static long ToLong(this string text) => long.Parse(text);
10371038
public static long ToInt64(this string text) => long.Parse(text);
10381039

1040+
public static long ToLong(this string text, long defaultValue) => long.TryParse(text, out var ret) ? ret : defaultValue;
10391041
public static long ToInt64(this string text, long defaultValue) => long.TryParse(text, out var ret) ? ret : defaultValue;
10401042

10411043
public static float ToFloat(this string text) => text == null ? default(float) : float.Parse(text);

0 commit comments

Comments
 (0)