Source.GetText Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient le texte à partir du fichier source.
Surcharges
| GetText(TextSpan) |
Obtient le texte inclus dans l'étendue de texte. |
| GetText(Int32, Int32, Int32, Int32) |
Obtient le texte entre les emplacements spécifiés. |
| GetText() |
Obtient la totalité du texte du fichier source. |
Remarques
Ces méthodes offrent différentes façons d’obtenir du texte à partir du fichier source.
GetText(TextSpan)
Obtient le texte inclus dans l'étendue de texte.
public:
System::String ^ GetText(Microsoft::VisualStudio::TextManager::Interop::TextSpan span);
public:
Platform::String ^ GetText(Microsoft::VisualStudio::TextManager::Interop::TextSpan span);
std::wstring GetText(Microsoft::VisualStudio::TextManager::Interop::TextSpan span);
public string GetText (Microsoft.VisualStudio.TextManager.Interop.TextSpan span);
member this.GetText : Microsoft.VisualStudio.TextManager.Interop.TextSpan -> string
Public Function GetText (span As TextSpan) As String
Paramètres
Retours
Texte inclus dans l'étendue de texte.
S’applique à
GetText(Int32, Int32, Int32, Int32)
Obtient le texte entre les emplacements spécifiés.
public:
System::String ^ GetText(int startLine, int startCol, int endLine, int endCol);
public:
Platform::String ^ GetText(int startLine, int startCol, int endLine, int endCol);
std::wstring GetText(int startLine, int startCol, int endLine, int endCol);
public string GetText (int startLine, int startCol, int endLine, int endCol);
member this.GetText : int * int * int * int -> string
Public Function GetText (startLine As Integer, startCol As Integer, endLine As Integer, endCol As Integer) As String
Paramètres
- startLine
- Int32
Première ligne de texte à obtenir.
- startCol
- Int32
Offset sur la première ligne vers le premier caractère à obtenir.
- endLine
- Int32
Dernière ligne de texte à obtenir.
- endCol
- Int32
Offset sur la dernière ligne vers le dernier caractère à obtenir.
Retours
Texte souhaité. Il peut s'agir d'une chaîne vide.
Remarques
Cette méthode transfère l’appel à la GetLineText méthode sur l' IVsTextLines objet passé au constructeur de Source classe. Cette méthode lève une exception si GetLineText retourne une erreur.
S’applique à
GetText()
Obtient la totalité du texte du fichier source.
public:
System::String ^ GetText();
public:
Platform::String ^ GetText();
std::wstring GetText();
public string GetText ();
member this.GetText : unit -> string
Public Function GetText () As String
Retours
Fichier source entier.
Remarques
Utilisez cette méthode pour accéder à l’intégralité du fichier source en tant que bloc de texte unique.
Cette méthode appelle la GetLastLineIndex méthode sur l' IVsTextLines objet passé au Source constructeur de classe, puis retourne le résultat de l’appel GetText(Int32, Int32, Int32, Int32) avec l’emplacement de début et de fin du fichier source. Cette méthode lève une exception si GetLastLineIndex retourne une erreur.