Could string comparisons really differ based on culture when the string is guaranteed not to change?

Absolutely. Per MSDN (http://msdn.microsoft.com/en-us/library/d93tkzah.aspx), This method performs a word (case-sensitive and culture-sensitive) search using the current culture. So you may get different results if you run it under a different culture (via regional and language settings in Control Panel). In this particular case, you probably won’t have a problem, but throw an i in the … Read more

Why can’t DateTime.ParseExact() parse “9/1/2009” using “M/d/yyyy”

I suspect the problem is the slashes in the format string versus the ones in the data. That’s a culture-sensitive date separator character in the format string, and the final argument being null means “use the current culture”. If you either escape the slashes (“M”https://stackoverflow.com/”d”https://stackoverflow.com/”yyyy”) or you specify CultureInfo.InvariantCulture, it will be okay. If anyone’s … Read more

how to set default culture info for entire c# application

Not for entire application or particular class. CurrentUICulture and CurrentCulture are settable per thread as discussed here Is there a way of setting culture for a whole application? All current threads and new threads?. You can’t change InvariantCulture at all. Sample code to change cultures for current thread: CultureInfo ci = new CultureInfo(theCultureString); Thread.CurrentThread.CurrentCulture = … Read more

Is Int32.ToString() culture-specific?

The Operating System allows to change the negative sign for numbers. Control panel -> Language and regional settings -> Additional settings -> Negative sign So, current culture could have overridden the negative sign. In this case you need to respect the regional settings, this is the reason of the warning. You can also change the … Read more

Is there a way of setting culture for a whole application? All current threads and new threads?

In .NET 4.5, you can use the CultureInfo.DefaultThreadCurrentCulture property to change the culture of an AppDomain. For versions prior to 4.5 you have to use reflection to manipulate the culture of an AppDomain. There is a private static field on CultureInfo (m_userDefaultCulture in .NET 2.0 mscorlib, s_userDefaultCulture in .NET 4.0 mscorlib) that controls what CurrentCulture … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)