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
-
IComparable<FormId<TForm>>IEquatable<FormId<TForm>>
- 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
ValueuintThe 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
Methods
CompareTo(FormId<TForm>)
Orders IDs by their number.
public int CompareTo(FormId<TForm> other)
Parameters
otherFormId<TForm>
Returns
Deconstruct(out uint)
public void Deconstruct(out uint Value)
Parameters
Valueuint
Equals(FormId<TForm>)
public bool Equals(FormId<TForm> other)
Parameters
otherFormId<TForm>
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
Returns the ID as eight hexadecimal digits.
public override string ToString()
Returns
Operators
operator ==(FormId<TForm>, FormId<Form>)
Whether both IDs identify the same form.
public static bool operator ==(FormId<TForm> left, FormId<Form> right)
Parameters
Returns
operator ==(FormId<TForm>, FormId<TForm>)
public static bool operator ==(FormId<TForm> left, FormId<TForm> right)
Parameters
Returns
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
Returns
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
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
idFormId<TForm>
Returns
operator !=(FormId<TForm>, FormId<Form>)
Whether the IDs identify different forms.
public static bool operator !=(FormId<TForm> left, FormId<Form> right)
Parameters
Returns
operator !=(FormId<TForm>, FormId<TForm>)
public static bool operator !=(FormId<TForm> left, FormId<TForm> right)
Parameters
Returns
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)