共用方式為


NormalizedSnapshotSpanCollection Class

A read-only collection of SnapshotSpan objects, all from the same snapshot.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Text.NormalizedSnapshotSpanCollection

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

Syntax

'宣告
Public NotInheritable Class NormalizedSnapshotSpanCollection _
    Implements IList(Of SnapshotSpan), ICollection(Of SnapshotSpan),  _
    IEnumerable(Of SnapshotSpan), IList, ICollection, IEnumerable
public sealed class NormalizedSnapshotSpanCollection : IList<SnapshotSpan>, 
    ICollection<SnapshotSpan>, IEnumerable<SnapshotSpan>, IList, 
    ICollection, IEnumerable
public ref class NormalizedSnapshotSpanCollection sealed : IList<SnapshotSpan>, 
    ICollection<SnapshotSpan>, IEnumerable<SnapshotSpan>, IList, 
    ICollection, IEnumerable
[<Sealed>]
type NormalizedSnapshotSpanCollection =  
    class
        interface IList<SnapshotSpan>
        interface ICollection<SnapshotSpan>
        interface IEnumerable<SnapshotSpan>
        interface IList
        interface ICollection
        interface IEnumerable
    end
public final class NormalizedSnapshotSpanCollection implements IList<SnapshotSpan>, ICollection<SnapshotSpan>, IEnumerable<SnapshotSpan>, IList, ICollection, IEnumerable

The NormalizedSnapshotSpanCollection type exposes the following members.

Constructors

  Name Description
Public method NormalizedSnapshotSpanCollection() Initializes an empty NormalizedSnapshotSpanCollection.
Public method NormalizedSnapshotSpanCollection(SnapshotSpan) Initializes a new instance of a NormalizedSnapshotSpanCollection with a single element.
Public method NormalizedSnapshotSpanCollection(IEnumerable<SnapshotSpan>) Initializes a new instance of a NormalizedSnapshotSpanCollection from a list of SnapshotSpan objects.
Public method NormalizedSnapshotSpanCollection(IList<SnapshotSpan>)
Public method NormalizedSnapshotSpanCollection(ITextSnapshot, NormalizedSpanCollection) Initializes a new instance of a NormalizedSnapshotSpanCollection from a NormalizedSpanCollection and a ITextSnapshot.
Public method NormalizedSnapshotSpanCollection(ITextSnapshot, IEnumerable<Span>) Initializes a new instance of a NormalizedSnapshotSpanCollection from a list of Span objects and a ITextSnapshot.
Public method NormalizedSnapshotSpanCollection(ITextSnapshot, IList<Span>)

Top

Properties

  Name Description
Public property Count Gets the number of spans in the collection.
Public property Item Gets the snapshot span at the specified location.

Top

Methods

  Name Description
Public method Contains(Object) Determines whether the collection contains the specified snapshot span.
Public method Contains(SnapshotSpan) Determines whether the collection contains the specified snapshot span.
Public method CopyTo(Array, Int32) Copies the snapshot spans in this collection to the specified array, starting at the specified index.
Public method CopyTo(array<SnapshotSpan[], Int32) Copies the collection to the specified array of snapshot spans at the specified location.
Public methodStatic member Difference Calculates the difference between two normalized snapshot span collections and normalizes the result.
Public method Equals Determines whether two snapshot span collections are the same. (Overrides Object.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 GetEnumerator Gets an enumerator for the collection.
Public method GetHashCode Gets a hash code for the collection. (Overrides Object.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IndexOf(Object) Gets the index of the specified snapshot span.
Public method IndexOf(SnapshotSpan) Gets the index of the specified SnapshotSpan.
Public methodStatic member Intersection Calculates the intersection of two normalized snapshot span collections and normalizes the result.
Public method IntersectsWith(NormalizedSnapshotSpanCollection) Determines whether this collection intersects with another normalized snapshot span collection.
Public method IntersectsWith(SnapshotSpan)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic member Overlap Calculates the overlap of two normalized snapshot span collections and normalizes the result.
Public method OverlapsWith(NormalizedSnapshotSpanCollection) Determines whether this normalized snapshot span collection overlaps with another collection.
Public method OverlapsWith(SnapshotSpan)
Public method ToString Converts the spans to a string. (Overrides Object.ToString().)
Public methodStatic member Union Calculates the union of two snapshot span collections and normalizes the result.

Top

Operators

  Name Description
Public operatorStatic member Equality Determines whether two NormalizedSnapshotSpanCollection objects are the same.
Public operatorStatic member Implicit(NormalizedSnapshotSpanCollection to NormalizedSpanCollection) Converts the specified NormalizedSnapshotSpanCollection to a NormalizedSpanCollection.
Public operatorStatic member Inequality Determines whether two NormalizedSnapshotSpanCollection are different.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method ICollection<SnapshotSpan>.Add Adds a snapshot span to the collection. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IList.Add Adds an object to the list. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method ICollection<SnapshotSpan>.Clear Clears the collection. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IList.Clear Clears the list. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator Gets an enumerator for the collection.
Explicit interface implemetationPrivate method IList<SnapshotSpan>.Insert Inserts a snapshot span into the list. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IList.Insert Inserts a snapshot span into the list at the specified location. This method throws a NotSupportedException.
Explicit interface implemetationPrivate property IList.IsFixedSize Determines whether the collection is of fixed size. Always returns true.
Explicit interface implemetationPrivate property ICollection<SnapshotSpan>.IsReadOnly Determines whether the collection is read-only. Always returns true.
Explicit interface implemetationPrivate property IList.IsReadOnly Determines whether this collection is read-only. This property always returns true.
Explicit interface implemetationPrivate property ICollection.IsSynchronized Determines whether this collection is synchronized.
Explicit interface implemetationPrivate property IList.Item Gets the snapshot span at the specified location.
Explicit interface implemetationPrivate method ICollection<SnapshotSpan>.Remove Removes the specified span from the collection. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IList.Remove Removes the specified snapshot span. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IList<SnapshotSpan>.RemoveAt Removes a snapshot span at the specified location. This method throws a NotSupportedException.
Explicit interface implemetationPrivate method IList.RemoveAt Removes a snapshot span at the specified location. This method throws a NotSupportedException.
Explicit interface implemetationPrivate property ICollection.SyncRoot Gets an object that can be used to synchronized access to this collection.

Top

Remarks

For more information about snapshots, see the section "A Closer Look at the Text Model and the Text View" in Inside the Editor.

The snapshot spans are sorted by start position. Adjacent and overlapping spans are combined.

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