Using ReSharper Plugins 1.0

Value Type Alias Formatter

The ReSharper Plugins project currently contains a single plugin that provides C# code formatting functionality. This formatting function allows for type declarations to be formatted between their alias type and their CLR type. For example, depending of the format settings defined in a code cleanup profile, bool can be converted to Boolean or Boolean converted to bool.

Configuration

The following displays the normal code format profile dialog.

ProfileSettings.jpg

When the plugin is installed, the code format profile dialog will include an additional format option called Type alias conversion.

CustomFormatProfile.jpg

The type conversion options are:
  • Do not change - No change is made to the code
  • Convert to alias type - References of CLR types are converted to their alias types (Boolean to bool for example)
  • Convert from alias type - References of alias types are converted to their CLR types (bool to Boolean for example)
The Do not change setting is the default value.

Type mappings

The following are the type mappings that are supported for converting types between alias types and their CLR types.

Alias type CLR type
object Object
char Char
string String
bool Boolean
byte Byte
short Int16
int Int32
long Int64
ushort UInt16
uint UInt32
ulong UInt64
double Double
decimal Decimal
float Single
sbyte SByte

Code examples

Code formatted to use alias types

AliasCode.jpg

Code formatted to use CLR types

CLRTypeCode.jpg

Last edited Jul 6, 2008 at 6:31 AM by rprimrose, version 4

Comments

No comments yet.