开发者

Manually set Culture Info Year Time Pattern

I would like to ask if it is a good coding practice to manually set the YearMonthPattern of the CurrentCulture? My problem is I set the current culture to Invariant, and the YearMonthPattern changed.

What I did is just added the code to set the YearMonthPattern just after setting the Cultures.

//Set Cultures
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(127);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(127);
//Set Year Month Pattern
System.Threading.Thread.CurrentThread.CurrentCulture.DateT开发者_开发百科imeFormat.YearMonthPattern = "MMMM, yyyy";


I can't see anything wrong with it. It's just that it might not be conform to the actual culture pattern but if that's how you want years to be displayed it is OK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜