CaretPosition Structure
Represents the position of a caret in an ITextView.
Assembly: Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)
| Name | Description | |
|---|---|---|
![]() | CaretPosition(VirtualSnapshotPoint, IMappingPoint, PositionAffinity) | Initializes a new instance of a CaretPosition. |
| Name | Description | |
|---|---|---|
![]() | Affinity | Gets the affinity of the caret. |
![]() | BufferPosition | Gets the position of the caret, corresponding to a gap between two characters in the ITextBuffer of the view. |
![]() | Point | Gets the IMappingPoint that marks the position of the caret in the buffer. |
![]() | VirtualBufferPosition | Gets the virtual buffer position as a VirtualSnapshotPoint. |
![]() | VirtualSpaces | Gets the number of spaces past the physical end of the line of the caret position. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether two CaretPosition objects are the same(Overrides ValueType.Equals(Object).) |
![]() | GetHashCode() | Gets the hash code for the CaretPosition.(Overrides ValueType.GetHashCode().) |
![]() | GetType() | (Inherited from Object.) |
![]() | ToString() | Provides a string representation of the caret position.(Overrides ValueType.ToString().) |
| Name | Description | |
|---|---|---|
![]() ![]() | Equality(CaretPosition, CaretPosition) | Determines whether two CaretPosition objects are the same. |
![]() ![]() | Inequality(CaretPosition, CaretPosition) | Determines whether two CaretPosition objects are different. |
To get the caret's current position, you can listen to the PositionChanged event. (You can get the caret from the ITextView.)The ITextCaret class includes methods that allow you to move the caret to a different position.
For an example of finding the caret position, see Walkthrough: Displaying Matching Braces.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



