SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Christoph Wille

What's New in SD5: Automatic Variable Naming

In the blog post Context Actions I showed how to refactor existing code into a new method, and how Link Mode allows you to rename it. But there was a slight problem which this code exhibited at that time:

Had I refactored "(j % 5)" into a new local variable (via Declare local variable), it would have named it "i". You got yourselves a name collision (same with NewMethod if you performed Extract Method twice before renaming the first instance).

The new behavior is as follows - you choose to Declare local variable:

SharpDevelop will look in the scope to see if there is already a variable "i" and append the next free number to it:

Because Link Mode is now enabled, you can immediately start typing and rename the variable to your liking:

As usual, you can grab the latest bits from our build server.

Published Feb 09 2014, 09:54 AM by ChristophWille
Filed under:

Comments

No Comments
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.