Paul Evans
Paul Evans

Reputation: 17

VB.NET code re-ordering to interface

Is there a simple way, without using external tools, to get the physical layout of my classes to match my interface?

If I have an interface, IFoo:

Interface IFoo
    Function DoFoo() As Integer
    Function DoBar() As Integer
End Function

I will end up with a class:

Class MyFoo
    Public Function DoFoo() As Integer Implements IFoo.DoFoo
        '...
    End Function

    Public Function DoBar() As Integer Implements IFoo.DoBar
        '...
    End Function
End Function

I then decide to add GetFoo() to my interface. I put it with DoFoo(), since it is a related thing and I want to group like terms. Visual Studio then tells me that the class no longer implements IFoo properly. The autogenerated code goes at the end of MyFoo.

What I would like to do is either get the item to be inserted in the correct place (under the previous item in the interface), or moved there post-event.

Not had anything very relevant come up using Google.

Upvotes: 0

Views: 65

Answers (1)

Ondřej
Ondřej

Reputation: 1673

There is not such functionality in Visual Studio. For this, I am using CodeMaid extension, which can arrange VB.NET code alphabetically and by type and scope. It really makes your code beautiful. There is also very good commercial extension called CodeRush for Roslyn which have much more features and it does organizing document little better.

Upvotes: 1

Related Questions