I want to override Format method of SmartFormat.SmartFormatter class. Can anyone give me a sample or any idea on how to do that?
Asked
Active
Viewed 44 times
1 Answers
0
The SmartFormat SmartFormatter class is not designed to be inherited. The best alternative is to create an extension method. Example:
public static class MySmartExtensions
{
public static string CreateComment(this SmartFormatter sf, string comment, string submittedBy)
{
return sf.Format("Comment from {0}: {1}", submittedBy, comment);
}
}
Usage:
Smart.Default.CreateComment("The comment", "joe@example.com");

axuno
- 581
- 4
- 15