blob: 3c5539c1f1201d3f7b492e14679a55b53696bb7e (
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
|
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
namespace Microsoft.VisualStudio.Text.Tagging
{
using System;
using Microsoft.VisualStudio.Utilities;
/// <summary>
/// Declares the types of tags an <see cref="ITagger<T>"/>
/// produces. This attribute is placed on the provider of the tagger.
/// </summary>
public sealed class TagTypeAttribute : MultipleBaseMetadataAttribute
{
private Type type;
/// <summary>
/// Initializes a new instance of a <see cref="TagTypeAttribute"/>.
/// </summary>
/// <param name="tagType">The tag type, which must derive from <see cref="ITag"/>.</param>
/// <exception cref="ArgumentNullException"><paramref name="tagType"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="tagType"/> does not derive from <see cref="ITag"/>.</exception>
public TagTypeAttribute(Type tagType)
{
if (tagType == null)
throw new ArgumentNullException(nameof(tagType));
if (!typeof(ITag).IsAssignableFrom(tagType))
throw new ArgumentException("Given type must derive from ITag", nameof(tagType));
this.type = tagType;
}
/// <summary>
/// Gets the type of the tag.
/// </summary>
public Type TagTypes
{
get { return type; }
}
}
}
|