次の方法で共有


IVsTextBuffer Interface

Acts as the base interface for the VsTextBuffer object and provides general information about the text buffer's properties. Also see IVsTextBufferEx, which adds GetTrackChanges and SetTrackChangesSuppression methods.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'宣言
<GuidAttribute("C08E5275-0D26-4DE9-8892-994024C23750")> _
<InterfaceTypeAttribute()> _
Public Interface IVsTextBuffer
'使用
Dim instance As IVsTextBuffer
[GuidAttribute("C08E5275-0D26-4DE9-8892-994024C23750")]
[InterfaceTypeAttribute()]
public interface IVsTextBuffer
[GuidAttribute(L"C08E5275-0D26-4DE9-8892-994024C23750")]
[InterfaceTypeAttribute()]
public interface class IVsTextBuffer
[<GuidAttribute("C08E5275-0D26-4DE9-8892-994024C23750")>]
[<InterfaceTypeAttribute()>]
type IVsTextBuffer =  interface end
public interface IVsTextBuffer

Remarks

The IVsTextBuffer interface provides basic services and text buffer properties, and is used by many clients. It contains information such as whether the buffer is read-only, whether the buffer has been modified, and which language service is associated with the buffer.

重要

Starting in Visual Studio 2010, you should access the text buffer on the UI thread, not on background threads. The text buffer no longer gets locked when you call LockBuffer or LockBufferEx. Similarly, the UnlockBuffer and UnlockBufferEx methods no longer have any effect.

IVsTextBuffer fires the IVsTextBufferEvents interface when there is a change in the language service. At the same time, the system notifies you of the switch to a different language service.

For the current buffer implementation, it is faster to read data from the interface IVsTextLines than to use IVsTextBuffer.

The position values used in this interface are a zero-based character index into a Unicode stream. It is always the caller's responsibility to ensure that requests do not index positions past the end of the buffer. Call the method GetSize to determine the character index position.

Notes to Callers

This interface is implemented as part of the VsTextBuffer object. As a VSPackage implementer, you call QueryInterface to get a pointer to the IVsTextBuffer interface when using the core editor objects.

See Also

Reference

IVsTextBuffer Members

Microsoft.VisualStudio.TextManager.Interop Namespace