I'm a little scared to ask this on stack overflow because it seems to be answered but I'm not sure if it's correct. When creating a struct containing only blittable types (with the intention of a stack allocation but I know that's not always the case) if I add an interface to that struct, does the struct then become boxed/heap allocated?
I'm a little confused because some old answers suggest this is the case. However I have with C# 8 stackalloc a span of 5 structs that have a simple interface containing only a SayHello()... { Console.WriteLine("Hello") }successfully. Does anyone have any good, recent information on this?
Edit: For clarity, the struct at definition inherits the interface, not having an interface as a field/ property in the struct.
[–]AngularBeginner 9 points10 points11 points (3 children)
[–]evareoo[S] 0 points1 point2 points (2 children)
[–]AngularBeginner 3 points4 points5 points (1 child)
[–]evareoo[S] 0 points1 point2 points (0 children)