update to vs2019

This commit is contained in:
NaBian committed 2019-06-01 15:19:54 +08:00
1 parent 5fd37e97fb
commit 8287c0a902
8 files changed
+107 -23

No files matched your search

@@ -0,0 +1,32 @@
using System;
using System.ComponentModel;
namespace HandyControl.Tools.Extension
{
public static class StringExtension
{
public static T Value<T>(this string input)
{
try
{
return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromString(input);
}
catch
{
return default(T);
}
}
public static object Value(this string input, Type type)
{
try
{
return TypeDescriptor.GetConverter(type).ConvertFromString(input);
}
catch
{
return null;
}
}
}
}