.NET Framework Bookmark and Share   
 index > .NET Base Class Library > System.Threading.Thread.CurrentThread.CurrentCulture.Calendar.TwoDigitYearMax
 

System.Threading.Thread.CurrentThread.CurrentCulture.Calendar.TwoDigitYearMax

I opened, converted, and rebuilt an existing class lib in 2005.  It compiled without error, but there was a runtime error with the following:

System.Threading.Thread.CurrentThread.CurrentCulture.Calendar.TwoDigitYearMax=2050

Apparently this property is readonly now.  Paradigm shift?  What to do?

Jeremy

Jeremy Grand

Paradigm shift may be a bit lofty but you are correct Smile- in Whidbey, we've made the default CurrentThread.CurrentCulture read-only.

You can, however, clone a copy, make modifications, and set the CurrentThread.CurrentCulture.

try the following:

CultureInfo
newCI = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();

newCI.Calendar.TwoDigitYearMax = 2050;

System.Threading.Thread.CurrentThread.CurrentCulture = newCI;

hope this helps,
-M

Matt Ayers
Incorrect post location:  Moving thread from "Forum Bug Reports" to ".NET Development General".
Joe Morel - MSFT2

Paradigm shift may be a bit lofty but you are correct Smile- in Whidbey, we've made the default CurrentThread.CurrentCulture read-only.

You can, however, clone a copy, make modifications, and set the CurrentThread.CurrentCulture.

try the following:

CultureInfo
newCI = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();

newCI.Calendar.TwoDigitYearMax = 2050;

System.Threading.Thread.CurrentThread.CurrentCulture = newCI;

hope this helps,
-M

Matt Ayers

You can use google to search for other answers

Custom Search

More Threads

• how to use WMI to get registry keys
• Scanners
• What does this constructor do?
• problem when using arraylist (IEnumerable)
• Datetime.Now() on XP v/s Datetime.Now() on Vista
• How To: Delete a print job in a printers queue if one exists.
• Logging to File with DateTime stamp
• Application Current Working Folder
• COM dll info in .NET
• mscorlib 2.0 behaves differently - exception thrown while consuming dll built targetting 1.1 framework