.net-4.6.2

How set a culture for entire winform application

折月煮酒 提交于 2020-08-09 08:17:54
问题 I want to set a culture for entire winform application. How can i do that? I changed my Program.cs file like this : using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Divar { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { var culture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentCulture

How set a culture for entire winform application

亡梦爱人 提交于 2020-08-09 08:17:09
问题 I want to set a culture for entire winform application. How can i do that? I changed my Program.cs file like this : using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Divar { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { var culture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentCulture

CultureInfo and Double.parse and double.toString not worked correctly

为君一笑 提交于 2020-01-07 04:20:28
问题 How can I force c# application to use . for decimal separator and ignore culture settings in server. I have this problem with double.ToString and double.parse I should change setting in application level because of large scale of application. exception occurse in case like double.parse("1/25") and 1.25 ToString I have Try This code string CultureName = Thread.CurrentThread.CurrentCulture.Name; CultureInfo ci = new CultureInfo(CultureName); if (ci.NumberFormat.NumberDecimalSeparator != ".") {

Nuget restore fails for ASP.NET Core 2.0 project on build server

谁说胖子不能爱 提交于 2019-12-22 03:21:45
问题 I am trying to build an ASP.NET Core 2.0 application for .NET Framework 4.6.2 (not .NET Core) with TeamCity on Windows Server 2012R2. The following components are installed in the server: Microsoft .Net Core SDK - 2.0.0.0 Microsoft .Net Framework (4.5.2, 4.6, 4.6.2) Microsoft Build Tools (2013, 2015, 2017) Windows SDK 10.0 ... TeamCity uses nuget version 4.1 and the solution file to restore dependent packages (see full log below for details). Error: [22:57:51] [22:57:51]Errors in C:\path\to

System.Net.Http NuGet package 4.3.0 reference generates System.IO.FileLoadException on System.Diagnostics.DiagnosticSource ver 4.0.0.0 reference

只谈情不闲聊 提交于 2019-12-21 07:04:53
问题 Description of the problem: A shared library "shared.dll" project references System.Net.Http NuGet package 4.3.0. The application that references "shared.dll" fails with System.IO.FileLoadException Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at System.Net

UseLegacyPathHandling is not loaded properly from app.config runtime element

柔情痞子 提交于 2019-12-20 03:21:58
问题 I'm trying to use the new long path support at my app. In order to use it, without forcing clients to have the newest .net 4.6.2 version instelled on their machines, one should only add those elements to his app.config (see the link for more info https://blogs.msdn.microsoft.com/dotnet/2016/08/02/announcing-net-framework-4-6-2/) : <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/> </startup> <runtime> <AppContextSwitchOverrides value="Switch.System.IO

StreamWriter: (Write+Flush)Async seem much slower then synchronous variants

烈酒焚心 提交于 2019-12-19 04:16:07
问题 I was trying to find an IO bottleneck in my class and surprisingly noticed that sw.Write("m"); sw.Flush() can be 20000 faster then await sw.WriteAsync("m"); Await sw.FlushAsync(); when writing 1000000 messages to a file. Does, by any chance, anyone know why? My bet is StreamWriter 's constructor taking a String does not parametrize a stream for async usage. The code below can be launched from C# interactive. Yes, it's not the best place to measure the speed but it will show the matter at hand

DataTemplates and Generics

十年热恋 提交于 2019-12-13 09:06:52
问题 I have read nearly a thousand posts explaining that setting a closed generic type as DataType on a DataTemplate does not work, because WPF wouldn't support that. But as a matter of fact, this is just wrong. I can define the following DataTemplate in my Window.Resources and it will be used when I assign a list of strings to a content control. For example: <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com

How to change WindowTaskScheduler RunDurationFor to Indefinitely

此生再无相见时 提交于 2019-12-11 12:27:59
问题 I have the method below to create TaskScheduler for Windows using ASquare.WindowsTaskScheduler, and it works as expected. public bool CreateTaskScheduler() { var file = $"{Setting.GetDirectory()}\\{Setting.GetSpacename()}.exe"; var response = WindowTaskScheduler .Configure() .CreateTask(TaskName, file) .RunDaily() .RunEveryXMinutes(5) .Execute(); if (response?.ErrorMessage != null) { System.Console.WriteLine(response?.ErrorMessage); } return response != null && response.IsSuccess; } Now the

“Could not load file or assembly” error when net462 app references a netstandard1.5 library. But why?

僤鯓⒐⒋嵵緔 提交于 2019-12-10 11:03:23
问题 I am trying to figure out what I could be doing wrong in this sample project. I am getting an error when my net462 application references a netstandard1.5 library. The application has a dependency on "System.Collections.Immutable": "1.3.0" , which targets NetStandard 1.0 according to Nuget. The library depends on "NETStandard.Library": "1.6.0" . Am I setting up either of these projects wrong? I would greatly appreciate any insight on this... Here are their project.json : app: { "buildOptions"