Skip to content

Instantly share code, notes, and snippets.

@fbstj fbstj/Components.cs
Created Mar 23, 2012

Embed
What would you like to do?
some extension methods for Control
public static int Value(this Control _, NumberStyles s, IFormatProvider p)
{
int d;
if (int.TryParse(_.Text, s, p, out d))
return d;
return 0;
}
public static double Value(this Control _)
{
double d;
if (double.TryParse(_.Text, out d))
return d;
return 0;
}
public static T[] Value<T>(this Control _, Converter<Control, T[]> converter) { return converter(_); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.