C# Class NBaseFormatter, shared-source-cli-2.0

This class provides a new formatting code: Bn where n is any number between 2 and 64. This Formatting code allows numbers to be printed out in any base. To get access to the formatting code, a user needs to pass NBaseFormatter provider to string.Format()
Inheritance: IFormatProvider, ICustomFormatter
ファイルを表示 Open project: gbarnett/shared-source-cli-2.0 Class Usage Examples

Public Methods

Method Description
Format ( string format, object arg, IFormatProvider provider ) : string

Once string.Format gets the ICustomFormatter, it calls this format method on each argument. This implements the ICustomFormatter interface.

GetFormat ( Type formatType ) : object

String.Format calls this method to get an instance of a ICustomFormatter to handle the formatting. In this case the same instance (this) is returned, but it would be possible return an instance of a different type. This method implements IFormatProvider

Method Details

Format() public method

Once string.Format gets the ICustomFormatter, it calls this format method on each argument. This implements the ICustomFormatter interface.
public Format ( string format, object arg, IFormatProvider provider ) : string
format string
arg object
provider IFormatProvider
return string

GetFormat() public method

String.Format calls this method to get an instance of a ICustomFormatter to handle the formatting. In this case the same instance (this) is returned, but it would be possible return an instance of a different type. This method implements IFormatProvider
public GetFormat ( Type formatType ) : object
formatType Type
return object