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.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.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)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
'Declaration
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
)
public:
void SetText(
int startLine,
int startCol,
int endLine,
int endCol,
String^ newText
)
member SetText :
startLine:int *
startCol:int *
endLine:int *
endCol:int *
newText:string -> unit
public function SetText(
startLine : int,
startCol : int,
endLine : int,
endCol : int,
newText : String
)
Parameters
startLine
Type: Int32The first line of source to replace.
startCol
Type: Int32The beginning offset of the first character on the first line to replace.
endLine
Type: Int32The last line of source to replace.
endCol
Type: Int32The last character offset on the last line to replace.
newText
Type: StringThe 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.