It is not field of your class but rather return value of a property getter - which is fine as it is just function return value.
Note that "as a member of a class" usually includes properties and probably should be changed to "field of a class".
If you would try to declare it as a class field (either directly or indirectly via auto-implemented property) this will require part of the class (the data for ref struct) to be allocated on the stack and the rest allocated in manged heap.
The code in the question defines non-autoimplemented property. As result there is no need for compiler to automatically create hidden field of the property type in the class. So while property result type is ref struct it actually is not stored in the class and hence does not violate requirement for this ref struct type not be included into any class. Note that even making setter method would be fine by itself - storing value for that property would be tricky, but you can safely store content of the ref struct (public int value; as in the post) in set and recreate it in get.
c.Itemand you'll see what you're actually doing with your declaration :)public RefStruct Item { get; set; } = default;Does that compile? What is the difference? What aboutpublic RefStruct Item2() { return new RefStruct(); }? Is your code more similar to the former or the latter?Field or auto-implemented property cannot be of type 'Program.RefStruct' unless it is an instance member of a ref struct.. The key principle here is that the compiler is enforcing that the object lives on the stack. It won't allow anything that results in the object living on the heap (whether that is a field or a field-backed property). I'll leave feedback on the page for you.Then what can you do in the setter?Whatever you want (e.g.newup the ref struct, write to the console etc etc). As long as you don't have an explicit or implicit field that is a ref struct. Any case you can think of is covered 100% by that error message. It is very precisely and accurately worded (unlike the docs).