Class NativeIdentityAttribute
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
Marks a member that exists only to give a value a name and a type, and that lowers to its own argument rather than to a call.
[AttributeUsage(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class NativeIdentityAttribute : Attribute
- Inheritance
-
NativeIdentityAttribute
- Inherited Members
Remarks
This is how GB# offers typed views over hardware indices without paying for
them. Sprites[0] is a NativeIdentityAttribute indexer:
it lowers to the constant 0, and the SpriteRef it
"returns" exists only in the type system. The hardware access happens in the
member accessed through it.
A member marked this way must take exactly one value through (the single argument, or the receiver for a parameterless instance member).