Added TypeDescriptor.GetConverter().ConvertFromInvariantString(..) to Cast.To(..)
ln.build - build0.waldrennach.l--n.de build job pending Details

master
Harald Wolff 2020-12-07 09:04:42 +01:00
parent 1b3255dbb0
commit 38bc2953d6
2 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@ using System.Reflection;
using System.Linq;
using System.Threading;
using System.Net.Http.Headers;
using System.ComponentModel;
namespace ln.type
{
@ -68,6 +69,10 @@ namespace ln.type
targetValue = castedArray;
}
else if ((value is string text) && (TypeDescriptor.GetConverter(targetType).CanConvertFrom(typeof(string))))
{
targetValue = TypeDescriptor.GetConverter(targetType).ConvertFromInvariantString(value as string);
}
else
{
targetValue = Convert.ChangeType(value, targetType);

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.3</Version>
<Version>0.1.4</Version>
<Authors>Harald Wolff-Thobaben</Authors>
<Company>l--n.de</Company>
<AssemblyVersion>0.0.1.0</AssemblyVersion>