Skip to content

Inline arrays – struct vs struct & reference types #42329

@deep-outcome

Description

@deep-outcome

Type of issue

Typo

Description

From https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/struct#inline-arrays

In addition, the compiler validates the System.Runtime.CompilerServices.InlineArrayAttribute attribute:

  • The length must be greater than zero (> 0).
  • The target type must be a struct.

There are minimal restrictions on the type of the single field. It can't be a pointer type, but it can be any reference type, or any value type. You can use inline arrays with almost any C# data structure.

So these two statements are in contrast one to another.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/struct#inline-arrays

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/builtin-types/struct.md

Document Version Independent Id

0960802e-80c3-cb56-cb8b-ab1f1b20fb4e

Article author

@BillWagner

Metadata

  • ID: d9220116-e950-04cf-b6d5-70d15a084a22
  • Service: dotnet-csharp
  • Sub-service: lang-reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnet-csharp/svchelp wantedGood for community contributors to help [up-for-grabs]in-prThis issue will be closed (fixed) by an active pull request.lang-reference/subsvc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions