Do you import namespaces and shorten the references?
  v1.0 Posted at 26/04/2018 8:44 AM by Tiago Araujo
You should import namespaces and shorten the references.

​System.Text.StringBuilder myStringBuilder = new System.Text.StringBuilder();

Figure: Bad code - Long reference to object name​​

using System.Text;
StringBuilder myStringBuilder = new StringBuilder();

Figure: Good code - Import the namespace and remove the repeated System.Text reference

If you have ReSharper installed, you can let ReSharper take care of this for you:

Figure: Right click and select "Reformat Code..."
Figure: Make sure "Shorten references" is checked and click "Reformat"​

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: