Table of Contents

Struct FormId<TForm>

Namespace
SkyrimForge.Game
Assembly
SkyrimForge.dll

The ID of a form whose view is TForm.

[JsonConverter(typeof(FormIdJsonConverter))]
public readonly struct FormId<TForm> : IComparable<FormId<TForm>>, IEquatable<FormId<TForm>> where TForm : struct, IForm

Type Parameters

TForm
Implements
Inherited Members

Remarks

The type is not checked. Reading Form throws for a form of another type, and FormOrNull returns null. A form ID encodes the load-order position of the .esm, .esp, or .esl file declaring the form, so store one beyond the running process only in a saved-state form entry or in JSON that System.Text.Json writes into saved-state text. Both are mapped through the load order the save recorded. The position differs between load orders, so compute the ID of a form in a named file with TESDataHandler.GetFormId rather than writing it as a constant. The game can assign the ID of a deleted runtime-created form (FF index) to another form.

Constructors

FormId(uint)

The ID of a form whose view is TForm.

public FormId(uint Value)

Parameters

Value uint

The number the game identifies the form by.

Remarks

The type is not checked. Reading Form throws for a form of another type, and FormOrNull returns null. A form ID encodes the load-order position of the .esm, .esp, or .esl file declaring the form, so store one beyond the running process only in a saved-state form entry or in JSON that System.Text.Json writes into saved-state text. Both are mapped through the load order the save recorded. The position differs between load orders, so compute the ID of a form in a named file with TESDataHandler.GetFormId rather than writing it as a constant. The game can assign the ID of a deleted runtime-created form (FF index) to another form.

Properties

Value

The number the game identifies the form by.

public uint Value { get; init; }

Property Value

uint

Methods

CompareTo(FormId<TForm>)

Orders IDs by their number.

public int CompareTo(FormId<TForm> other)

Parameters

other FormId<TForm>

Returns

int

Deconstruct(out uint)

public void Deconstruct(out uint Value)

Parameters

Value uint

Equals(FormId<TForm>)

public bool Equals(FormId<TForm> other)

Parameters

other FormId<TForm>

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

Returns the ID as eight hexadecimal digits.

public override string ToString()

Returns

string

Operators

operator ==(FormId<TForm>, FormId<Form>)

Whether both IDs identify the same form.

public static bool operator ==(FormId<TForm> left, FormId<Form> right)

Parameters

left FormId<TForm>
right FormId<Form>

Returns

bool

operator ==(FormId<TForm>, FormId<TForm>)

public static bool operator ==(FormId<TForm> left, FormId<TForm> right)

Parameters

left FormId<TForm>
right FormId<TForm>

Returns

bool

operator ==(FormId<TForm>?, FormId<Form>?)

Whether both IDs are null or identify the same form.

public static bool operator ==(FormId<TForm>? left, FormId<Form>? right)

Parameters

left FormId<TForm>?
right FormId<Form>?

Returns

bool

explicit operator FormId<TForm>(FormId<Form>)

Converts id to the ID of a TForm without checking the form's type.

public static explicit operator FormId<TForm>(FormId<Form> id)

Parameters

id FormId<Form>

Returns

FormId<TForm>

implicit operator FormId<Form>(FormId<TForm>)

Converts id to the ID of a form of any type.

public static implicit operator FormId<Form>(FormId<TForm> id)

Parameters

id FormId<TForm>

Returns

FormId<Form>

operator !=(FormId<TForm>, FormId<Form>)

Whether the IDs identify different forms.

public static bool operator !=(FormId<TForm> left, FormId<Form> right)

Parameters

left FormId<TForm>
right FormId<Form>

Returns

bool

operator !=(FormId<TForm>, FormId<TForm>)

public static bool operator !=(FormId<TForm> left, FormId<TForm> right)

Parameters

left FormId<TForm>
right FormId<TForm>

Returns

bool

operator !=(FormId<TForm>?, FormId<Form>?)

Whether one ID alone is null or the IDs identify different forms.

public static bool operator !=(FormId<TForm>? left, FormId<Form>? right)

Parameters

left FormId<TForm>?
right FormId<Form>?

Returns

bool