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
minimum xp install
winxp unstable
Can I use DoCmd.CopyObject to copy a form with VBA code from one database to another?
Terminal Services CAL issue
How kill a process launching with a .bat file by ShellExecuteex ?
Video Rental Database
Casting local variable int as varchar to concatenate into another string using transact-sql
OOTB Approval Workflow without the emails?
How do I hide the splash screen on application load? VB.NET 2005
Exporting .pst file data to SQL Server 2005