Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

Neovolve ReSharper Plugins 1.0 released

I have just released the ReSharper Plugins 1.0 in my NeovolveX extensibility project on CodePlex. This plugin formats code as part of the ReSharper code format profiles.

The following is a copy of the Using ReSharper Plugins 1.0 documentation on the project site

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

Grab it from here.

Written on July 6, 2008