mirror of https://github.com/dotnet/runtime
Merge a16ff24377
into 02596ba8d9
This commit is contained in:
commit
fc3766b0e8
|
@ -852,6 +852,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\DiscardableAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\EnumeratorCancellationAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ExtensionAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ExtensionMarkerNameAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\FixedAddressValueTypeAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\FixedBufferAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\FormattableStringFactory.cs" />
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 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).
|
||||
/// This attribute should not be used by developers in source code.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
|
||||
public sealed class ExtensionMarkerNameAttribute : Attribute
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="ExtensionMarkerNameAttribute"/> class.</summary>
|
||||
/// <param name="name">The name of the marker type this extension member is associated with.</param>
|
||||
public ExtensionMarkerNameAttribute(string name)
|
||||
=> Name = name;
|
||||
|
||||
/// <summary>The name of the marker type this extension member is associated with.</summary>
|
||||
public string Name { get; }
|
||||
}
|
||||
}
|
|
@ -13495,6 +13495,13 @@ namespace System.Runtime.CompilerServices
|
|||
{
|
||||
public ExtensionAttribute() { }
|
||||
}
|
||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Delegate, Inherited = false)]
|
||||
public sealed partial class ExtensionMarkerNameAttribute : System.Attribute
|
||||
{
|
||||
public ExtensionMarkerNameAttribute(string name) { }
|
||||
public string Name { get { throw null; } }
|
||||
}
|
||||
[System.AttributeUsageAttribute(System.AttributeTargets.Field)]
|
||||
public sealed partial class FixedAddressValueTypeAttribute : System.Attribute
|
||||
{
|
||||
|
|
|
@ -235,6 +235,15 @@ namespace System.Runtime.CompilerServices.Tests
|
|||
Assert.Equal(version, attr.Version);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("1")]
|
||||
[InlineData("2")]
|
||||
public static void ExtensionMarkerNameAttributeTests(string name)
|
||||
{
|
||||
var attr = new ExtensionMarkerNameAttribute(name);
|
||||
Assert.Equal(name, attr.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void ReferenceAssemblyAttributeTests()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue