Sub SortUsingStatements()
Dim selectedText As TextSelection
Dim line As String
Dim out As String
Dim nonSystem As String
Dim systemLines As String
Dim systemOnly As String
selectedText = DTE.ActiveDocument.Selection
Dim lines() As String = Split(selectedText.Text, vbLf)
System.Array.Sort(lines)
For Each line In lines
If line.Contains("System;") Then
systemOnly = line + vbLf
ElseIf line.Contains("System") Then
systemLines = systemLines + line + vbLf
Else
nonSystem = nonSystem + line + vbLf
End If
Next
out = systemOnly + systemLines + nonSystem
selectedText.Insert(out)
End Sub
Wednesday, February 08, 2006
For the Code Nazis amongst you
A Visual Studio 2005 macro that sorts the using statements.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment