You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I started writing some game engin that reads some 15 years old file format (Tomb Raider II levels) and these levels are made of structures (look here) that contains arrays. Most are fixed-size.
So I needed to do something like that:
I get this error: Attribute 'System.Runtime.InteropServices.MarshalAsAttribute' is not valid on this declaration type. It is valid on Field, Parameter, ReturnValue only.
So I need to make that property a property with backing field so that I can put the MarshalAs on the field that looks like that private tr2_colour[] _palette; and then it works.
It'd be great if it was possible to put attributes on auto-properties so that they go automatically on the backing field.
The text was updated successfully, but these errors were encountered:
Recently, I started writing some game engin that reads some 15 years old file format (Tomb Raider II levels) and these levels are made of structures (look here) that contains arrays. Most are fixed-size.
So I needed to do something like that:
It works, but if I replace
ushort
by a structure, heretr2_colour
, I get an error.I get this error:
Attribute 'System.Runtime.InteropServices.MarshalAsAttribute' is not valid on this declaration type. It is valid on Field, Parameter, ReturnValue only.
So I need to make that property a property with backing field so that I can put the MarshalAs on the field that looks like that
private tr2_colour[] _palette;
and then it works.It'd be great if it was possible to put attributes on auto-properties so that they go automatically on the backing field.
The text was updated successfully, but these errors were encountered: