Breyta

Deila með


InlineArrayAttribute Class

Definition

Indicates that the instance's storage is sequentially replicated Length times.

public ref class InlineArrayAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Struct, AllowMultiple=false)]
public sealed class InlineArrayAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Struct, AllowMultiple=false)>]
type InlineArrayAttribute = class
    inherit Attribute
Public NotInheritable Class InlineArrayAttribute
Inherits Attribute
Inheritance
InlineArrayAttribute
Attributes

Examples

The following example shows how to declare an inline array type with eight float values.

[InlineArray(8)]
struct Float8InlineArray
{
    private float _value;
}

Remarks

This attribute can be used to annotate a struct type with a single field. The runtime replicates that field in the actual type layout as many times as is specified.

Important

.NET 9 and later, the default implementations of Equals() and GetHashCode() for types marked with this attribute throw NotSupportedException. You must override both Equals(Object) and GetHashCode if they will be used.

Constructors

InlineArrayAttribute(Int32)

Creates a new InlineArrayAttribute instance with the specified length.

Properties

Length

Gets the number of sequential fields to replicate in the inline array type.

TypeId

When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)

Methods

Equals(Object)

Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode()

Returns the hash code for this instance.

(Inherited from Attribute)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute()

When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object)

When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to