Share via


ITextDocumentFactoryService.TryGetTextDocument Method

Retrieve an ITextDocument for the given buffer, if one exists.

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Declaration
Function TryGetTextDocument ( _
    textBuffer As ITextBuffer, _
    <OutAttribute> ByRef textDocument As ITextDocument _
) As Boolean
bool TryGetTextDocument(
    ITextBuffer textBuffer,
    out ITextDocument textDocument
)
bool TryGetTextDocument(
    ITextBuffer^ textBuffer, 
    [OutAttribute] ITextDocument^% textDocument
)
abstract TryGetTextDocument : 
        textBuffer:ITextBuffer * 
        textDocument:ITextDocument byref -> bool
function TryGetTextDocument(
    textBuffer : ITextBuffer, 
    textDocument : ITextDocument
) : boolean

Parameters

Return Value

Type: System.Boolean
true if a document exists for this buffer, false otherwise.

Exceptions

Exception Condition
ArgumentNullException

textBuffer is nulla null reference (Nothing in Visual Basic).

.NET Framework Security

See Also

Reference

ITextDocumentFactoryService Interface

Microsoft.VisualStudio.Text Namespace