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
runtime error 3134 access
query to show anything due in the current week
Only select results with multiple columns that are > 0
Canoscan D646u ex on Windows Vista or Seven
Text Field "Overflow" (Needs to be scrolled) indicator
Access rule ISA 2006
Delprof Selective Profile Delete
missing files after chkdsk!!!!!!!!!!!!
Is there a way to convert a printdocument to a bitmap?
=Hyperlink with Vlookup results in "Cannot Open Specified File"