enter image description here我开发了一个需要调度程序组件的程序 而且此组件没有波斯语日期时间,现在我想创建一个 .dll中具有波斯日期时间的属性... 我会覆盖这个.dll吗?
答案 0 :(得分:1)
如果它是virtual
,则可以override
。在这种情况下,您可以像这样使用Extension methods
:
public static class YourClass
{
public static string GetPersianDate(this dll.Class param)
{
// Do your business
}
}
编辑: 看我的例子。
public static class MyClass
{
public static string GetPersianDate(this DateTime dateTime)
{
PersianCalendar pc = new PersianCalendar();
return string.Format("{0}/{1}/{2}", pc.GetYear(dateTime), pc.GetMonth(dateTime), pc.GetDayOfMonth(dateTime));
}
}