Christian
Christian

Reputation: 1090

Refactor all code files to remove type qualifiers

Imagine this scenario: You open a Visual Studio solution that contains multiple projects and a whole lot of C# code. Some old code that you have never seen before. You need to remove all redundant type qualifiers without having to go throug the code manually. What do you do??

I have seen other people suggest using search-and-replace but thats not very pratical. My solution contains a lot of projects and files. A lot of it is old code that I know for sure contains a whole lot of redundant qualifiers. Its like the old developder had some sort of OCD with using type qualifiers.

How can I remove all type qualifiers in the whole solution? I have tried all sorts of refactoring extensions that can manipulate my code in a bunch of ways... but none of them can figure out how to change

System.Collections.Generic.List<SomeObject> myList = new System.Collections.Generic.List<SomeObject>(); 
var item = new MyApp.Controls.Models.Car();

to

List<SomeObject> myList = new List<SomeObject>(); 
var item = new Car();

Upvotes: 0

Views: 168

Answers (1)

wikiCan
wikiCan

Reputation: 449

Dont click option go to the arrow and find Arrange qualifiers everywhere in solution.

You can do it for most of fix. Not just remove redundant qualifier. Use resharper.

enter image description here

Upvotes: 1

Related Questions