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
vba code to go to a clear the content of a text box and move cursor to that text box
Access 2003 delete buttons greyed out
VBA querytables.refresh not working
calling oracle stored procedues from VC++ using ADO
Forms, tab control and subforms
Xbox 360 live wireless G vs N router
WIndows 7 client in 2003 domain vbs logon script
"blue arrows" display on Outlook folders--ASAP--
Can a Lookup column be used in a calculated column
extend Windows Server 2003 group policy to suport Vista / 7