Microsoft
Software
Hardware
Network
Question : how can I override the DateTime class to add a custom method??
Hi, I want to override the default class System.DateTime to add a custom method, now i'm doing it this way (but doesn't works):
partial class DateTime
{
public string ToStringFormated()
{
return base.ToString(AppConfig.da
teFormat);
}
}
i''m getting a incoherence accessibility error.
Answer : how can I override the DateTime class to add a custom method??
DateTime is a class, you cannot derive a new class to override it.
The unique way is to use an extension method, but you require C# 3.0 for this (VS 2008), but still can use .net 2.0
Is that your case?
Random Solutions
System.OutOfMemoryExceptio<wbr />n when filling dataset with 655,000 rows - need workaround!!
Exchange 2007 Autodiscover & OAB & OOF not working anymore
How to delete a row based on the value of a cell? (macro)
Long SQL String is Wrapping and Not Running in Access VBA
How does DBCC test the integrity of a database?
What does an MFC resource file with texts of more than one language look like?
Create Pie Chart in Excel 2007
Delphi to VB.NET
Any way to use old printer on Windows 7
Why do I get an access denied error when I try to view the files inside the folder redirect folders?