-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
PartMetadataAttribute.cs
46 lines (43 loc) · 1.63 KB
/
PartMetadataAttribute.cs
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
44
45
46
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Composition
{
/// <summary>
/// Specifies metadata for a type to be used as a part.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public class PartMetadataAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PartMetadataAttribute"/> with the
/// specified name and metadata value.
/// </summary>
/// <param name="name">
/// A <see cref="string"/> containing the name of the metadata value; or
/// <see langword="null"/> to use an empty string ("").
/// </param>
/// <param name="value">
/// An <see cref="object"/> containing the metadata value. This can be
/// <see langword="null"/>.
/// </param>
public PartMetadataAttribute(string name, object value)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Value = value;
}
/// <summary>
/// Gets the name of the metadata value.
/// </summary>
/// <value>
/// A <see cref="string"/> containing the name of the metadata value.
/// </value>
public string Name { get; }
/// <summary>
/// Gets the metadata value.
/// </summary>
/// <value>
/// An <see cref="object"/> containing the metadata value.
/// </value>
public object Value { get; }
}
}