Windows Phone 7 development

Usefull helper

The default parsing method for C# using current culture, which sucks really badly. ( I wrote about it on SO)

Here a lil helper  that I use

public static class Helper
public static bool TryParseDouble(this TextBox textbox, out double value)
if (double.TryParse(textbox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
textbox.Foreground = Brushes.Black;
return true;
textbox.Foreground = Brushes.Red;
return false;

public static bool TryParseDouble(this string text, out double value)
return double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out value);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: