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
simple MS SQL count query
Retrieving just the first instance of each customer using SQL
Help Using RtlMoveMemory from kernel32 in VB.NET
MP3 & 4 burn to audio cd with win 7
Access / VBA / return to previous record after form after update event triggers
How do you set up a SQL report to export multiple sheets to Excel?
hidden files on server - windows 2003 server
Cannot extract bitmap from resources section of app!
ASP.NET - Database Class
Receiving error code 0x800702e4 when trying to download with InDownloadMngr while in IE 8 with Win7 runing (64 bit) what do I do?