我在 asp net core mvc 中的十进制数字方面遇到了一些问题。我通过将其添加到 web.config 来使其在常规 ASP Net 应用程序中工作:
<system.web>
...
<globalization uiCulture="en" culture="en-US"/>
</system.web>
Run Code Online (Sandbox Code Playgroud)
但是,由于核心应用程序中没有 web.config,我不太确定该怎么做。核心中最接近的近似值会是什么样子?
我的目标是循环通过List<weatherForecast> weatherList,看它是否包含特定值。但是,每次我运行该程序时,它都会冻结。
通过注释掉循环的各个部分,似乎除了之外的所有其他东西都在foreach loop工作,但是我foreach在程序的其他部分使用了几乎与此相同的语句,并且它们工作正常。
Boolean flag;
for (DateTime day1 = DateTime.Parse(sDate); day1 <= DateTime.Parse(eDate); day1.AddDays(1))
{
flag = false;
foreach (WeatherForecast w in weatherList)
{
if (selected.Contains(w.City) && w.getDay().CompareTo(day1) == 0)
{
flag = true;
}
}
if (!flag)
{
day1 = DateTime.Parse(eDate).AddDays(1);
MessageBox.Show("Some of the dates in the range you selected do not have weather data. \nDefault data will be used,but you can enter the data manually.", "Missing Data", …Run Code Online (Sandbox Code Playgroud)