Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove [EditorBrowsable(Never)] from [InlineArray], add XML docs #94308

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
// 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 as many times as specified in the actual type layout.
Sergio0694 marked this conversation as resolved.
Show resolved Hide resolved
/// </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>
/// <para>
/// The compiler will also automatically generate an indexer property, and support casting the type
/// to <see cref="Span{T}"/> and <see cref="ReadOnlySpan{T}"/> for safe enumeration of all elements.
/// </para>
Sergio0694 marked this conversation as resolved.
Show resolved Hide resolved
/// </remarks>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class InlineArrayAttribute : Attribute
{
/// <summary>Creates a new <see cref="InlineArrayAttribute"/> instance with the specified parameters.</summary>
Sergio0694 marked this conversation as resolved.
Show resolved Hide resolved
/// <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