ITextBufferFactoryService.CreateTextBuffer 方法 (String, IContentType)

创建一个具有指定的 IContentTypeITextBuffer,并使用给定文本填充它。

命名空间:  Microsoft.VisualStudio.Text
程序集:  Microsoft.VisualStudio.Text.Data(在 Microsoft.VisualStudio.Text.Data.dll 中)

语法

声明
Function CreateTextBuffer ( _
    text As String, _
    contentType As IContentType _
) As ITextBuffer
ITextBuffer CreateTextBuffer(
    string text,
    IContentType contentType
)
ITextBuffer^ CreateTextBuffer(
    String^ text, 
    IContentType^ contentType
)
abstract CreateTextBuffer : 
        text:string * 
        contentType:IContentType -> ITextBuffer
function CreateTextBuffer(
    text : String, 
    contentType : IContentType
) : ITextBuffer

参数

  • text
    类型:String

    要添加的初始文本。

返回值

类型:Microsoft.VisualStudio.Text.ITextBuffer
一个具有给定文本和 IContentTypeITextBuffer 对象。

异常

异常 条件
ArgumentNullException

text 或 contentType 为 nullnull 引用(在 Visual Basic 中为 Nothing)。

.NET Framework 安全性

请参阅

参考

ITextBufferFactoryService 接口

CreateTextBuffer 重载

Microsoft.VisualStudio.Text 命名空间