Saturday 30 May 2015

C# - APS.Net - How to fix error - The name 'GetCultureInfo' does not exist in the current context


Watch on YouTube:



Replace

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

namespace WebApplication1
{
    public partial class ErrorTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            double err;
            bool valid = double.TryParse("3.3", NumberStyles.Currency, GetCultureInfo("en-us"), out err);
        }
    }
}

with

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;

namespace WebApplication1
{
    public partial class ErrorTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            double err;
            bool valid = double.TryParse("3.3", NumberStyles.Currency, CultureInfo.GetCultureInfo("en-us"), out err);
        }
    }
}

No comments:

Post a Comment