blob: 5ebfe29f059bb1adfba23624a688f447288d2458 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
using System;
namespace Microsoft.VisualStudio.Text.Tagging
{
/// <summary>
/// Associates an <see cref="ITag" /> with a given <see cref="ITrackingSpan" />.
/// This is used by SimpleTagger to provide buffer-level tracking and caching of tag spans.
/// </summary>
/// <typeparam name="T">The type, which must be a subclass of <see cref="ITag"/>.</typeparam>
public class TrackingTagSpan<T> where T : ITag
{
/// <summary>
/// The tag located in this span.
/// </summary>
public T Tag { get; private set; }
/// <summary>
/// The tracking span for this tag.
/// </summary>
public ITrackingSpan Span { get; private set; }
/// <summary>
/// Initializes a new instance of a <see cref="TrackingTagSpan<T>"/>.
/// </summary>
/// <param name="span">The tracking span with which to associate the tag.</param>
/// <param name="tag">The tag associated with the span.</param>
/// <exception cref="ArgumentNullException"><paramref name="span"/> or <paramref name="tag"/> is null.</exception>
public TrackingTagSpan(ITrackingSpan span, T tag)
{
if (span == null)
throw new ArgumentNullException("span");
if (tag == null)
throw new ArgumentNullException("tag");
Span = span;
Tag = tag;
}
}
}
|