Skip to content

Commit 734519c

Browse files
committed
Extract Convert.ChangeType into a new ConvertString method
The purpose of this commit is to trigger CI on AppVeyor to verify that all tests are passing since 30 of them do not pass on my machine (macOS 10.12.6 with JetBrains Rider 2017.3 and mono 5.4.1.7)
1 parent 6b5c039 commit 734519c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/CommandLine/Core/TypeConverter.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ private static Maybe<object> ChangeTypeScalar(string value, Type conversionType,
4949
return result.ToMaybe();
5050
}
5151

52+
private static object ConvertString(string value, Type type, CultureInfo conversionCulture)
53+
{
54+
return Convert.ChangeType(value, type, conversionCulture);
55+
}
56+
5257
private static Result<object, Exception> ChangeTypeScalarImpl(string value, Type conversionType, CultureInfo conversionCulture, bool ignoreValueCase)
5358
{
5459
Func<object> changeType = () =>
@@ -71,10 +76,9 @@ private static Result<object, Exception> ChangeTypeScalarImpl(string value, Type
7176
() =>
7277
#if !SKIP_FSHARP
7378
isFsOption
74-
? FSharpOptionHelper.Some(type, Convert.ChangeType(value, type, conversionCulture)) :
79+
? FSharpOptionHelper.Some(type, ConvertString(value, type, conversionCulture)) :
7580
#endif
76-
Convert.ChangeType(value, type, conversionCulture);
77-
81+
ConvertString(value, type, conversionCulture);
7882
#if !SKIP_FSHARP
7983
Func<object> empty = () => isFsOption ? FSharpOptionHelper.None(type) : null;
8084
#else

0 commit comments

Comments
 (0)