Udostępnij za pośrednictwem


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.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.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: 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.

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

See Also

Reference

Source Class

SetText Overload

Microsoft.VisualStudio.Package Namespace