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
Databinding drop-down controls, order of events issue...
How to activate the "Gridlines" group in the Design tab (for reports)?
Disconnected network drive connects again at logon
Exchange is in recovery mode
School Timetable in MS Excel
The difference between the server types "Web Front End" and "Stand-alone?"
WSUS 3.0 sp2 server 2003 x86 to 2008 R2 x64
Error Handler won't close forms
Export to excel in ssrs 2008
What is the best way to upgrade AD/Exchange Server