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
Access MasterPage Function from UserWebControl Referenced from MasterPage
VSTO Merge Module
The remote computer does not support remoteapp
SharePoint "webpage cannot be found" error message after installation
SQL : Validation Records Before Insert
add/edit/delete from dataset, and bind a field in dataset to a combobox,
Excel too slow.
Access SQL: Self Join with Multiple Criteria
Setting up Server 2008 in a branch office with SBS 2008
General question about MasterPages and ContentPlaceHolders