波斯日历不适用于CultureInfo [英] Persian Calendar not valid with CultureInfo

查看:96
本文介绍了波斯日历不适用于CultureInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码怎么了?

错误(异常)消息:


对于给定的文化而言不是有效的日历。

Not a valid calendar for the given culture.



System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("fa-Ir"); //Error
ci.DateTimeFormat.Calendar = new System.Globalization.PersianCalendar();
Application.CurrentCulture = ci;

这是什么解决方案?

我可以添加 Calendar 键入Windows XP的区域选​​项?

And what's its solution?
Can I add a Calendar type to Windows XP regional option?

推荐答案

基于反射的变通方法是:

a dirty reflection-based workaround is here :

< a href = http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/4768d48e-aa04-4c15-b688-a58fa4373bc9/ rel = nofollow> http://social.msdn .microsoft.com / forums / zh-CN / netfxbcl / thread / 4768d48e-aa04-4c15-b688-a58fa4373bc9 /

这篇关于波斯日历不适用于CultureInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆