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
ReportViewer Export to PDF Loses Tabs or Multiple Blnak Spaces
Error:Cannot open database". It may not be a database that your application recognizes, or the file may be corrupt.
Get specified line contents
MS Project 2007, How to add a Column 'Percent'
vb.net selected item from listview
using required field validators to validate inputs for a textbox on an asp.net page
New RAM Causing laptop to shut down
How to Send Alert Info from Dell Open Manager Via Email
Microsoft Visual Web Developer -- ISO offline ?
need install windows from lan