Class CapacityAttribute
- Namespace
- GB
- Assembly
- GBSharp.Framework.dll
The capacity of a fixed-capacity collection, fixed at compile time.
[AttributeUsage(AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class CapacityAttribute : Attribute
- Inheritance
-
CapacityAttribute
- Inherited Members
Remarks
Thesis section 11 writes this as FixedList<Enemy, 8>. C# has no
value type parameters, so that is not valid C#, and GB# will not invent a
dialect that only looks like C#. The capacity therefore travels as an
attribute on the declaration.
What matters is preserved: the capacity is written at the declaration, in the source, where the developer reading the field can see exactly how much memory it costs.
Constructors
CapacityAttribute(int)
public CapacityAttribute(int capacity)
Parameters
capacityint
Properties
Capacity
public int Capacity { get; }