Condividi tramite


ITextDocumentFactoryService.CreateAndLoadTextDocument Method (String, IContentType, Encoding, Boolean%)

Creates an ITextDocument that opens and loads the contents of the file into a new ITextBuffer.

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

Syntax

'Dichiarazione
Function CreateAndLoadTextDocument ( _
    filePath As String, _
    contentType As IContentType, _
    encoding As Encoding, _
    <OutAttribute> ByRef characterSubstitutionsOccurred As Boolean _
) As ITextDocument
ITextDocument CreateAndLoadTextDocument(
    string filePath,
    IContentType contentType,
    Encoding encoding,
    out bool characterSubstitutionsOccurred
)
ITextDocument^ CreateAndLoadTextDocument(
    String^ filePath, 
    IContentType^ contentType, 
    Encoding^ encoding, 
    [OutAttribute] bool% characterSubstitutionsOccurred
)
abstract CreateAndLoadTextDocument : 
        filePath:string * 
        contentType:IContentType * 
        encoding:Encoding * 
        characterSubstitutionsOccurred:bool byref -> ITextDocument 
function CreateAndLoadTextDocument(
    filePath : String, 
    contentType : IContentType, 
    encoding : Encoding, 
    characterSubstitutionsOccurred : boolean
) : ITextDocument

Parameters

  • filePath
    Type: System.String
    The full path to the file to be loaded.
  • encoding
    Type: System.Text.Encoding
    The encoding to use. The decoder part of the Encoding object will not be used.
  • characterSubstitutionsOccurred
    Type: System.Boolean%
    [out] Set to true if some of the file bytes could not be directly translated using the given encoding.

Return Value

Type: Microsoft.VisualStudio.Text.ITextDocument
The ITextDocument.

Exceptions

Exception Condition
ArgumentNullException

filePath, contentType, or encoding is nulla null reference (Nothing in Visual Basic).

.NET Framework Security

See Also

Reference

ITextDocumentFactoryService Interface

CreateAndLoadTextDocument Overload

Microsoft.VisualStudio.Text Namespace