-1

hi i have a code that writed in .Net 4.5

CultureInfo.DefaultThreadCurrentUICulture = value;

now i need to use this code in .net 4.0 but it seems This code is not available in .NET 4.0 What is the same code in .NET 4.0? I'm new, please help

davod kh
  • 23
  • 4
  • 1
    You had to set the current culture in each thread (if needed) setting `CultureInfo.CurrentUICulture = value`. For a typical UI application you had to do it just once (because you _probably_ have ALL your UI related code in one thread - or dispatched to the UI thread). Possibly `CurrentCulture` had to be specified multiple times because it affects, for example, how user input is parsed/converted (for example when formatting a `DateTime` to/from `striing`). – Adriano Repetti May 04 '20 at 11:55
  • Please try to add more context around the question so that's easier to understand and give you the right answer – ihor.eth May 04 '20 at 17:06

1 Answers1

0

I usually set my application culture this way:

using System.Globalization;
using System.Threading;

Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr-CA");
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr-CA");

If you are working on a multithreaded application, you need to set it at the beginning of each thread.

jscarle
  • 1,045
  • 9
  • 17