Embed Selection
- 2 minutes to read
In This Article
Embeds the selection into the specified code block. The following code blocks are available:
Code Block | Description |
---|---|
try.. |
Embeds the selection into the try.. |
try.. |
Embeds the selection into the try.. |
try.. |
Embeds the selection into the try.. |
#region..#endregion | Embeds the selection between the #region and #endregion directives and selects the created region name. |
#if..#endif | Embeds the selection between the #if and #endif directives and places the cursor after the #if directive. |
while() | Embeds the selection into the while() code block, places the cursor into the conditional statement brackets, and drops a marker onto the initial selection. |
do.. |
Embeds the selection into the do.. |
using() | Embeds the selection into the using() code block, places the cursor into the brackets, and drops a marker onto the initial selection. |
lock() | Embeds the selection into the lock() code block, places the cursor into the brackets, and drops a marker onto the initial selection. |
block - { } | Encloses the selection in braces and selects the whole generated block. |
Begin |
Embeds the selection between the Begin |
Wait |
Embeds the selection into the try.. |
To string | Quotes the selected code section and selects the whole generated block. |
Comment box | Embeds the selection into the comment box and selects the whole generated block. |
#Availability
From the context menus or via shortcuts:
- when one or more code lines are selected.
#Example
private string TestMethod(string FileName)
{│TestMethod1()
TestMethod2()
}
Private Sub TestMethod()│TestMethod1()
TestMethod2()
End Sub
Result:
private string TestMethod(string FileName)
{│try
{
TestMethod1()
TestMethod2()
}
catch (Exception ex)
{
}
}
Private Sub TestMethod()│Try
TestMethod1()
TestMethod2()
Catch ex As Exception
End Try
End Sub