共用方式為


SnapshotSpan Structure

An immutable text span in a particular text snapshot.

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

Syntax

'宣告
Public Structure SnapshotSpan
public struct SnapshotSpan
public value class SnapshotSpan
[<Sealed>]
type SnapshotSpan =  struct end
JScript supports the use of structures, but not the declaration of new ones.

The SnapshotSpan type exposes the following members.

Constructors

  Name Description
Public method SnapshotSpan(ITextSnapshot, Span) Initializes a new instance of a SnapshotSpan with the specified snapshot and span.
Public method SnapshotSpan(SnapshotPoint, SnapshotPoint) Initializes a new instance of a SnapshotSpan from two SnapshotPoint objects.
Public method SnapshotSpan(SnapshotPoint, Int32) Initializes a new instance of a SnapshotSpan from an existing SnapshotPoint and a specified length.
Public method SnapshotSpan(ITextSnapshot, Int32, Int32) Initializes a new instance of a SnapshotSpan with the specified snapshot, start point, and length.

Top

Properties

  Name Description
Public property End Gets the end of the snapshot span.
Public property IsEmpty Determines whether or not this span is empty.
Public property Length Gets the length of the span, which is always non-negative.
Public property Snapshot The ITextSnapshot to which this snapshot span refers.
Public property Span Gets the span covered by the snapshot span.
Public property Start Gets the starting index of the snapshot span.

Top

Methods

  Name Description
Public method Contains(Int32) Determines whether the position lies within the span.
Public method Contains(SnapshotPoint) Determines whether the specified SnapshotPoint lies within the span.
Public method Contains(SnapshotSpan) Determines whether the snapshot span falls completely within this span.
Public method Contains(Span) Determines whether the specified span falls completely within this span.
Public method Equals Determines whether two snapshot spans are the same. (Overrides ValueType.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for this type. (Overrides ValueType.GetHashCode().)
Public method GetText The text contained by this snapshot span.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Intersection(SnapshotSpan) Calculates the intersection with the given SnapshotSpan.
Public method Intersection(Span) Calculates the intersection with the given span.
Public method IntersectsWith(SnapshotSpan) Determines whether the specified snapshot span intersects this span.
Public method IntersectsWith(Span) Determines whether the specified span intersects this span.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Overlap(SnapshotSpan) Gets the overlap with the given SnapshotSpan.
Public method Overlap(Span) Getss the overlap with the given span.
Public method OverlapsWith(SnapshotSpan) Determines whether another span overlaps this span.
Public method OverlapsWith(Span) Determines whether simpleSpan overlaps this span.
Public method ToString Converts this snapshot span to a string. (Overrides ValueType.ToString().)
Public method TranslateTo Translates this snapshot span to a different snapshot of the same ITextBuffer.

Top

Operators

  Name Description
Public operatorStatic member Equality Determines whether two snapshot spans are the same.
Public operatorStatic member Implicit(SnapshotSpan to Span) Implicitly converts a snapshot span to a span.
Public operatorStatic member Inequality Determines whether two snapshot spans are different.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Text Namespace