StringName
An interned engine name with a C# wrapper: value, emptiness and string conversions.
A C# class wrapping an interned engine name. Equal text values share an internal representation but can belong to different managed StringName objects. ReferenceEquals therefore does not replace name-value equality.
Conversions between string and StringName are supported. For example, StringName name = "player" creates a name wrapper; ToString() returns its text. C# has no &"player" string literal.
StringName has no C# conversion to bool. Use is null to check the managed reference, and IsEmpty to check an empty name after checking the reference. Do not assume StringName exposes every System.String method: obtain a string value for string operations first.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors2
StringName2 overloads
public StringName();Creates a distinct managed object holding an empty name. IsEmpty is true and ToString() returns an empty string. The object exists and is not null.
public StringName(string name);Creates a managed wrapper for an interned name. Case and character sequence are preserved; no Unicode normalization is applied. Equal names can have distinct managed wrappers: compare values with == or Equals rather than ReferenceEquals. An empty string and, in the current SDK, null produce an empty name. Pass a non-null string in ordinary code.
The example returns true. Each locally created object has its own using lifetime; C# has no &"player" literal.
using System;
using Reckfell;
public static class StringNameExamples
{
public static bool SameName()
{
using StringName first = "player";
using var second = new StringName("player");
return first == second && !ReferenceEquals(first, second)
&& first.ToString() == "player";
}
}| Name | Type | Default |
|---|---|---|
name | string | — |
nameName text. An empty string creates an empty name; whitespace is not trimmed.
Properties1
IsEmptyProperty
public bool IsEmpty { get; }Checks whether the native name is empty. A new StringName() and a name created from an empty string have IsEmpty == true. This does not check the managed reference: first test name is not null. It does not test for whitespace or replace resource lifetime management.
Methods15
Dispose2 overloads
public void Dispose();Releases the wrapper’s owned reference to the native name, unregisters the resource and suppresses finalization. The managed reference does not become null; other independently created wrappers for the same name remain valid.
Dispose an owned object exactly once, normally with using. In the current SDK, repeating Dispose() on a previously registered nonempty wrapper throws ArgumentException ("Disposable not registered"); idempotence is not guaranteed. Do not call Dispose() manually inside using or dispose borrowed names, including shared API constants. Do not use the object after disposal or leave it as a dictionary key: its native identity and hash change.
public void Dispose(bool disposing);Low-level disposal overload. In the current implementation, both disposing values release the native name and unregister the resource. This method does not call GC.SuppressFinalize itself. Application code should use parameterless Dispose() or using; a direct call can leave finalization scheduled for an already released resource. Repeated unregistration can throw ArgumentException.
| Name | Type | Default |
|---|---|---|
disposing | bool | — |
disposingDisposal-path flag; the current implementation releases the resource for both true and false. It does not preserve the native name when false.
Equals3 overloads
public bool Equals(in Reckfell.NativeInterop.reckfell_string_name other);Native interop overload: compares the name’s internal identity with a valid reckfell_string_name. An empty wrapper equals an empty native name. This method neither transfers ownership nor releases the argument. Ordinary game code should use Equals(StringName).
| Name | Type | Default |
|---|---|---|
other | Reckfell.NativeInterop.reckfell_string_name | — |
otherValid native name whose lifetime covers the call; default represents an empty name. Do not dispose a borrowed value.
booltrue if the native name identities match; otherwise false.
public bool Equals(StringName? other);Compares the interned name value with another managed wrapper. Comparison is case-sensitive; distinct wrappers of identical text are equal. null differs even from an existing empty StringName.
| Name | Type | Default |
|---|---|---|
other | StringName | — |
otherOther name wrapper, or null.
booltrue for identical interned names; false for a different name or null.
public override bool Equals(object? obj);Returns true for the same reference or another StringName with the same value. This overload does not convert string to StringName: a string passed as object is not equal to the name, even with identical text.
| Name | Type | Default |
|---|---|---|
obj | object | — |
objObject to test; StringName is compared by value, while other types and null do not match.
booltrue only for a StringName with the same value, including the same reference; otherwise false.
GetHashCodeint
public override int GetHashCode();Returns a hash of the name’s internal native pointer. Equal live names have equal hashes and work as Dictionary<StringName, T> keys. Different names may share a hash. Do not persist the result or use it as a network or stable identifier: it is not a portable text hash. Disposing the object changes its hash.
intHash of the current internal name identity; stability across runs is not guaranteed.
ToStringstring
public override string ToString();Returns the name text as a managed string, preserving case and Unicode. Returns string.Empty for an empty name. Does not dispose the StringName. Obtain a string before applying System.String operations.
stringName text, or an empty string for an empty name.
op_Equality3 overloads
public static bool operator ==(in Reckfell.NativeInterop.reckfell_string_name left, StringName? right);Native interop overload comparing internal name identities. Here a managed null equals an empty native name, unlike managed-wrapper comparison where null differs from an empty wrapper. Operand order does not change the result. Neither argument is disposed.
| Name | Type | Default |
|---|---|---|
left | Reckfell.NativeInterop.reckfell_string_name | — |
right | StringName | — |
leftValid native name; default is empty. Its lifetime must cover the call.
rightManaged wrapper or null; null corresponds to an empty native name.
booltrue for identical native identities, including null and an empty native name; otherwise false.
public static bool operator ==(StringName? left, in Reckfell.NativeInterop.reckfell_string_name right);Native interop overload comparing internal name identities. Here a managed null equals an empty native name, unlike managed-wrapper comparison where null differs from an empty wrapper. Operand order does not change the result. Neither argument is disposed.
| Name | Type | Default |
|---|---|---|
left | StringName | — |
right | Reckfell.NativeInterop.reckfell_string_name | — |
leftManaged wrapper or null; null corresponds to an empty native name.
rightValid native name; default is empty. Its lifetime must cover the call.
booltrue for identical native identities, including null and an empty native name; otherwise false.
public static bool operator ==(StringName? left, StringName? right);Compares the case-sensitive values of two managed wrappers. Two null references are equal; null and an existing empty wrapper differ. ReferenceEquals instead checks whether the wrappers themselves are the same object.
| Name | Type | Default |
|---|---|---|
left | StringName | — |
right | StringName | — |
leftManaged wrapper to compare, or null.
rightManaged wrapper to compare, or null.
booltrue for identical names or two null references; otherwise false.
op_Implicit2 overloads
public static implicit operator string(StringName? from);Calls ToString() for an existing wrapper and returns null for null. Distinguish a null reference from an empty name: an empty StringName converts to "", while an absent reference converts to null. Does not transfer ownership of the wrapper.
| Name | Type | Default |
|---|---|---|
from | StringName | — |
fromName to read, or null.
stringName text; an empty string for an empty name; null for an absent wrapper.
public static implicit operator StringName(string from);Creates a new managed wrapper, equivalent to new StringName(from). Even when the text is already interned, the wrapper is a distinct object with its own lifetime. Use using when the conversion creates your local resource; do not dispose someone else’s shared wrapper.
| Name | Type | Default |
|---|---|---|
from | string | — |
fromSource text. An empty string and, in the current SDK, null produce an empty name.
StringNameNew StringName wrapper, including a distinct empty wrapper for empty input.
op_Inequality3 overloads
public static bool operator !=(in Reckfell.NativeInterop.reckfell_string_name left, StringName? right);Negates the corresponding ==. Native interop overload comparing internal name identities. Here a managed null equals an empty native name, unlike managed-wrapper comparison where null differs from an empty wrapper. Operand order does not change the result. Neither argument is disposed.
| Name | Type | Default |
|---|---|---|
left | Reckfell.NativeInterop.reckfell_string_name | — |
right | StringName | — |
leftValid native name; default is empty. Its lifetime must cover the call.
rightManaged wrapper or null; null corresponds to an empty native name.
booltrue for differing native identities under the stated null rule; otherwise false.
public static bool operator !=(StringName? left, in Reckfell.NativeInterop.reckfell_string_name right);Negates the corresponding ==. Native interop overload comparing internal name identities. Here a managed null equals an empty native name, unlike managed-wrapper comparison where null differs from an empty wrapper. Operand order does not change the result. Neither argument is disposed.
| Name | Type | Default |
|---|---|---|
left | StringName | — |
right | Reckfell.NativeInterop.reckfell_string_name | — |
leftManaged wrapper or null; null corresponds to an empty native name.
rightValid native name; default is empty. Its lifetime must cover the call.
booltrue for differing native identities under the stated null rule; otherwise false.
public static bool operator !=(StringName? left, StringName? right);Negates ==. Compares the case-sensitive values of two managed wrappers. Two null references are equal; null and an existing empty wrapper differ. ReferenceEquals instead checks whether the wrappers themselves are the same object.
| Name | Type | Default |
|---|---|---|
left | StringName | — |
right | StringName | — |
leftManaged wrapper to compare, or null.
rightManaged wrapper to compare, or null.
booltrue if the names or null state differ; otherwise false.