[InlineArray(3)] // Notice this attribute (in System.Runtime.CompilerServices); this means this struct will act as an array of three elements.
struct ThreeStringBuffer {
string _; // The element type is defined by the single field declared in the struct. The name is unimportant and won't be seen anywhere, so I use '_'.
}
// .. Usage:
static void Test() {
var buffer = new ThreeStringBuffer();
buffer[0] = "Hello";
buffer[1] = "I'm";
buffer[2] = "Ben";
Console.WriteLine(buffer[0] + " " + buffer[1] + " " + buffer[2]); // Prints "Hello I'm Ben" on console
}
Code snippet taken from "Complete C# Quick Reference - C# 12".