Source.SetText Method (Int32, Int32, Int32, Int32, String)
Replaces the specified section of source with the given text.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Syntax
'Declaração
Public Sub SetText ( _
startLine As Integer, _
startCol As Integer, _
endLine As Integer, _
endCol As Integer, _
newText As String _
)
public void SetText(
int startLine,
int startCol,
int endLine,
int endCol,
string newText
)
Parameters
- startLine
Type: System.Int32
The first line of source to replace.
- startCol
Type: System.Int32
The beginning offset of the first character on the first line to replace.
- endLine
Type: System.Int32
The last line of source to replace.
- endCol
Type: System.Int32
The last character offset on the last line to replace.
- newText
Type: System.String
The new text.
Remarks
This method validates the input range, then calls the ReplaceLines method to replace the specified section with the new text.
If newText is a null value, then the given span is deleted.
This method can throw an exception if there was an error.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.