Split Using Statement

Splits the current multi-declaration using statement into several using statements.

Availability

Available from the context menu or via shortcuts:

  • when the cursor is on the using keyword, provided that the current using statement contains more than one declaration.

Notes

Examples

string toString = string.Empty;
using (Pen p1 = new Pen(Color.Black), p2 = new Pen(Color.Black))
{
    toString += p1.ToString();
    toString += p2.ToString();
}
Dim toString As String = String.Empty
Using p As Pen = New Pen(Color.Black), p1 As Pen = New Pen(Color.Black)
    toString += p.ToString()
    toString += p1.ToString()
End Using

Result:

string toString = string.Empty; 
using (Pen p1 = new Pen(Color.Black)) 
{ 
    toString += p1.ToString(); 
} 
using (Pen p2 = new Pen(Color.Black)) 
{ 
    toString += p2.ToString(); 
}
Dim toString As String = String.Empty
Using p As Pen = New Pen(Color.Black)
    toString += p.ToString()
End Using
Using p1 As Pen = New Pen(Color.Black)
    toString += p1.ToString()
End Using

Screenshot

rsSplitUsingStatement