public static T To(this string text)
{
return (T)Convert.ChangeType(text, typeof(T));
}
// sample usage
int val = "124".To();
double dbl = "124.5".To();
© Anup Shah on WPF and Silverlight (Programming Garden) 2016 . Powered by Blogger . Created by Weblyb Bankifsccode
No comments:
Post a Comment