Refactoring using JustCode

In this post we will see Refactoring techniques using Telerik JustCode. Telerik Just Code helps to perform following refactor operation.

You can perform many refactoring using Teleirk Just Code. Few of the refactoring can be performed are as below,

  • Convert Abstract class to Interface
  • Convert Interface to Abstract class
  • Convert Anonymous method to Lambda
  • Convert Anonymous method to Named Method
  • Convert Class selector to ID selector in CSS
  • Convert ID selector to Class selector in CSS
  • Convert Constructor to Factory method
  • Convert Extension method to Static method
  • Convert Method to Property
  • Convert Lambda to Named Method
  • Convert Lambda to Anonymous method and many more

Let us see few of the refactoring; we can perform using Telerik JustCode

Convert Abstract class to Interface

Let us s you have abstract class as below,

image

This class can be refactored to interface using Telerik Just Code.

  • Select class and press Alt+Insert
  • Choose R option
  • From R option choose convert to Interface

image

After converting resultant interface would be as below,

image

Convert Anonymous method to Lambda Expression

I have created a delegate as below,

image

And using delegate with anonymous function as below,

image

Above anonymous function can be converted to Lambda Expression as below,

  • Select anonymous function and press Alt+Insert
  • Choose R option
  • From R option choose convert to Interface

image

Resultant lambda expression would be as below,

image

Convert Anonymous method to Named Method

If you want to convert above anonymous method to named method, you can very much do that as below,

  • Select anonymous function and press Alt+Insert
  • Choose R option
  • From R option choose To Named Method

image

Resultant named method would be as below,

image

Convert Constructor to Factor Method

I have a class with constructor as below,

image

If you want to convert constructor to factory method, you can do that as below,

  • Select constructor and press Alt+Insert
  • Choose R option
  • From R option choose Convert Constructor to Factor method

image

Resultant factor method would be as below,

image

In similar way you can perform other refactoring operations using Telerik Just Code. I hope this post is useful. Thanks for reading

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.