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
FrontPage 2003 WEBDav question
how to run a batch file from an asp.net 2.0 web page?
using a where clause in a vertical lookup excel
How to import Excel worksheet to DataGridView keeping cell colors
Can't Connect Remotely to SQL Server 2008
FileSystemWatcher VB.Net How to check if File is opened by application
sql updating a table
SQL Errors - Cannot execute as the database principal
How to Restart the IIS in Local System in Windows XP
split column