© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
26 replies
MaxHayman

Inline array of struct assignment

Hey,

I am trying to implement something using inline arrays, however I am struggling to get a way to do it in a clean way.
    [System.Runtime.CompilerServices.InlineArray(10)]
    public struct Buffer10<T>
    {
        private T _element0;
    }

 public Buffer10<Header> Headers { get; set; }

    public void AddHeader(Header header)
    {
        Headers[HeadersCount++] = header;
    }
    [System.Runtime.CompilerServices.InlineArray(10)]
    public struct Buffer10<T>
    {
        private T _element0;
    }

 public Buffer10<Header> Headers { get; set; }

    public void AddHeader(Header header)
    {
        Headers[HeadersCount++] = header;
    }


gets

Error CS0131 : The left-hand side of an assignment must be a variable, property or indexer
Error CS0131 : The left-hand side of an assignment must be a variable, property or indexer


I am sure this worked in preview .net 8.

Does anyone have any experience using inline arrays yet. It feels rough having to have some kind of proxy struct and i wish you could do this on the field/property level.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Array Assignment Error
C#CC# / help
3y ago
❔ Separating struct array data
C#CC# / help
4y ago
Interaction of 'first class spans' with inline array types/Extension methods over inline array types
C#CC# / help
6mo ago