Having created my own type of number (actually DoubleDouble ), I want to implement the IFormattable interface. So I need to somehow parse the format string.
public string ToString(string format, IFormatProvider formatProvider) { // formatting string according to format and using formatprovider? return formattedString; }
The class user should be able to use it as a replacement for double (or any other number format).
String.Format("{0:0.##}", (DoubleDouble)123.4567);
My question is: does anyone know a good tutorial about this, or can give me some tips? How to maintain localization in this process?
How to parse a format string? Are there any methods to help with this task, or should I do all of this with a regexp hand, etc.
I really looked for help, but could not find it, if you find something in another language (C, C ++) that can help, please tell me about it.
string tostring c # formatting
John deo
source share