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
Mapping drive to Win 7 machine
add image to Newsflash module layout in Joomla template
Track user logon/logoff to the access database.
Deadlock When Doing Begin and Commit Transaction.
Web.config app error problem
Error Type mistach when creating and running Excel macro through Access
Access 2007 merge form + subform to Word
Load updates from Sql text files
SBS2008 Error 50331656 Remote Desktop
How to retrieve and submit using secondary data connections in InfoPath