Skip to content

Commit f4335bd

Browse files
committed
Add ExtensionMarkerAttribute
1 parent 6e7f599 commit f4335bd

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using System.Runtime.CompilerServices;
2+
3+
[assembly: TypeForwardedTo(typeof(ExtensionMarkerAttribute))]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.ComponentModel;
5+
6+
namespace System.Runtime.CompilerServices
7+
{
8+
/// <summary>
9+
/// This attribute is used to mark extension members and associate them with a specific marker type (which provides detailed information about an extension block and its receiver parameter).
10+
/// This attribute should not be used by developers in source code.
11+
/// </summary>
12+
[EditorBrowsable(EditorBrowsableState.Never)]
13+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
14+
public sealed class ExtensionMarkerAttribute : Attribute
15+
{
16+
/// <summary>Initializes a new instance of the <see cref="ExtensionMarkerAttribute"/> class.</summary>
17+
/// <param name="name">The name of the marker type this extension member is associated with.</param>
18+
public ExtensionMarkerAttribute(string name)
19+
=> Name = name;
20+
21+
/// <summary>The name of the marker type this extension member is associated with.</summary>
22+
public string Name { get; }
23+
}
24+
}

0 commit comments

Comments
 (0)