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

Commit 7f1aed5

Browse files
committed
Move To string extensions to ServiceStack.Text
1 parent b7d738c commit 7f1aed5

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,6 @@ namespace ServiceStack
2626
{
2727
public static class StringExtensions
2828
{
29-
public static T To<T>(this string value)
30-
{
31-
return TypeSerializer.DeserializeFromString<T>(value);
32-
}
33-
34-
public static T To<T>(this string value, T defaultValue)
35-
{
36-
return String.IsNullOrEmpty(value) ? defaultValue : TypeSerializer.DeserializeFromString<T>(value);
37-
}
38-
39-
public static T ToOrDefaultValue<T>(this string value)
40-
{
41-
return String.IsNullOrEmpty(value) ? default(T) : TypeSerializer.DeserializeFromString<T>(value);
42-
}
43-
44-
public static object To(this string value, Type type)
45-
{
46-
return TypeSerializer.DeserializeFromString(value, type);
47-
}
48-
4929
/// <summary>
5030
/// Converts from base: 0 - 62
5131
/// </summary>
@@ -1266,3 +1246,29 @@ public static T FromXml<T>(this string json)
12661246

12671247
}
12681248
}
1249+
1250+
namespace ServiceStack.Text
1251+
{
1252+
public static class StringTextExtensions
1253+
{
1254+
public static T To<T>(this string value)
1255+
{
1256+
return TypeSerializer.DeserializeFromString<T>(value);
1257+
}
1258+
1259+
public static T To<T>(this string value, T defaultValue)
1260+
{
1261+
return String.IsNullOrEmpty(value) ? defaultValue : TypeSerializer.DeserializeFromString<T>(value);
1262+
}
1263+
1264+
public static T ToOrDefaultValue<T>(this string value)
1265+
{
1266+
return String.IsNullOrEmpty(value) ? default(T) : TypeSerializer.DeserializeFromString<T>(value);
1267+
}
1268+
1269+
public static object To(this string value, Type type)
1270+
{
1271+
return TypeSerializer.DeserializeFromString(value, type);
1272+
}
1273+
}
1274+
}

0 commit comments

Comments
 (0)