Skip to content

Commit

Permalink
Remove [EditorBrowsable(Never)] from [InlineArray], add XML docs (#94308
Browse files Browse the repository at this point in the history
)

* Remove [EditorBrowsable] from [InlineArray]

* Add XML comments

* Tweak XML docs following review comments

Co-authored-by: Stephen Toub <stoub@microsoft.com>

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
  • Loading branch information
Sergio0694 and stephentoub authored Nov 3, 2023
1 parent aac9923 commit 80666e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
// 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>
/// Indicates that the instance's storage is sequentially replicated "length" times.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
/// <remarks>
/// <para>
/// This attribute can be used to annotate a <see langword="struct"/> type with a single field.
/// The runtime will replicate that field in the actual type layout as many times as is specified.
/// </para>
/// <para>
/// Here's an example of how an inline array type with 8 <see cref="float"/> values can be declared:
/// <code lang="csharp">
/// [InlineArray(8)]
/// struct Float8InlineArray
/// {
/// private float _value;
/// }
/// </code>
/// </para>
/// </remarks>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class InlineArrayAttribute : Attribute
{
/// <summary>Creates a new <see cref="InlineArrayAttribute"/> instance with the specified length.</summary>
/// <param name="length">The number of sequential fields to replicate in the inline array type.</param>
public InlineArrayAttribute(int length)
{
Length = length;
}

/// <summary>Gets the number of sequential fields to replicate in the inline array type.</summary>
public int Length { get; }
}
}
1 change: 0 additions & 1 deletion src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12905,7 +12905,6 @@ public sealed partial class InterpolatedStringHandlerAttribute : System.Attribut
public InterpolatedStringHandlerAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Struct, AllowMultiple = false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class InlineArrayAttribute : System.Attribute
{
public InlineArrayAttribute(int length) { }
Expand Down

0 comments on commit 80666e8

Please sign in to comment.