In the last versions of Telerik JustCode we added some nice features that will help you quickly refactor your code, so let’s start right away.

Convert If To Switch Statement

JustCode now detects the if-statements that can be converted to a switch statement and suggests doing it for you. Place your cursor on the if-statement and hit Alt+Enter or choose the F menu from VisualAid, select ‘Convert if to switch statement’.


Convert If To Conditional Expression

Another if conversion that we added is to convert an if-statement to a conditional expression (or ternary operator as some people call it). Place your cursor on the if-statement and hit Alt+Enter or choose the F menu from VisualAid, select ‘Convert if to conditional expression’.


More info: here

Pull Members To Base Type

We’ve had this one for some time but it got a lot better recently. Now you can select multiple members with direct selection in code or in the dialog window that pops up. You can also select a particular base type where you’d like your members to be moved to. Code speaks better than just words:

Press Alt+Ins to bring out the refactorings menu or you can access it from the VisualAid. Select ‘Pull Members To Base Type…’.

You can also execute it on the class identifier which will select all members automatically.

More info: here

Convert Property To Method(s)

You can easily change a class member from property to method without going through each usage and updating it manually.  If it has both a getter and a setter – two methods will be created for each.

Place your cursor on the property and select ‘Convert Property To Method(s)’ from the refactorings menu.

That’s it for today, we hope you like it, there is much more to come. Your feedback is welcome and appreciated – write to us in forum or support.

Happy Coding!

The JustCode team

About the Author

Chris Eargle

is a Microsoft C# MVP with over a decade of experience designing and developing enterprise applications, and he runs the local .NET User Group: the Columbia Enterprise Developers Guild. He is a frequent guest of conferences and community events promoting best practices and new technologies. Chris is a native Carolinian; his family settled the Dutch Form region of South Carolina in 1752. He currently resides in Columbia with his wife, Binyue, his dog, Laika, and his three cats: Meeko, Tigger, and Sookie. Amazingly, they all get along... except for Meeko, who is by no means meek.

Related Posts