reckfellENGINE

StringName

An interned engine name with a C# wrapper: value, emptiness and string conversions.

On this page
class StringNameReckfellSharp

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
# StringName · 1/2
C#
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.

# StringName · 2/2
C#
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.

C#
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";
    }
}
Parameters
NameTypeDefault
namestring—
name

Name text. An empty string creates an empty name; whitespace is not trimmed.

Properties1

IsEmptyProperty
# IsEmpty
C#
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
# Dispose · 1/2
C#
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.

# Dispose · 2/2
C#
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.

Parameters
NameTypeDefault
disposingbool—
disposing

Disposal-path flag; the current implementation releases the resource for both true and false. It does not preserve the native name when false.

Equals3 overloads
# Equals · 1/3
C#
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).

Parameters
NameTypeDefault
otherReckfell.NativeInterop.reckfell_string_name—
other

Valid native name whose lifetime covers the call; default represents an empty name. Do not dispose a borrowed value.

Returns bool

true if the native name identities match; otherwise false.

# Equals · 2/3
C#
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.

Parameters
NameTypeDefault
otherStringName—
other

Other name wrapper, or null.

Returns bool

true for identical interned names; false for a different name or null.

# Equals · 3/3
C#
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.

Parameters
NameTypeDefault
objobject—
obj

Object to test; StringName is compared by value, while other types and null do not match.

Returns bool

true only for a StringName with the same value, including the same reference; otherwise false.

GetHashCodeint
# GetHashCode
C#
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.

Returns int

Hash of the current internal name identity; stability across runs is not guaranteed.

ToStringstring
# ToString
C#
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.

Returns string

Name text, or an empty string for an empty name.

op_Equality3 overloads
# op_Equality · 1/3
C#
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.

Parameters
NameTypeDefault
leftReckfell.NativeInterop.reckfell_string_name—
rightStringName—
left

Valid native name; default is empty. Its lifetime must cover the call.

right

Managed wrapper or null; null corresponds to an empty native name.

Returns bool

true for identical native identities, including null and an empty native name; otherwise false.

# op_Equality · 2/3
C#
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.

Parameters
NameTypeDefault
leftStringName—
rightReckfell.NativeInterop.reckfell_string_name—
left

Managed wrapper or null; null corresponds to an empty native name.

right

Valid native name; default is empty. Its lifetime must cover the call.

Returns bool

true for identical native identities, including null and an empty native name; otherwise false.

# op_Equality · 3/3
C#
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.

Parameters
NameTypeDefault
leftStringName—
rightStringName—
left

Managed wrapper to compare, or null.

right

Managed wrapper to compare, or null.

Returns bool

true for identical names or two null references; otherwise false.

op_Implicit2 overloads
# op_Implicit · 1/2
C#
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.

Parameters
NameTypeDefault
fromStringName—
from

Name to read, or null.

Returns string

Name text; an empty string for an empty name; null for an absent wrapper.

# op_Implicit · 2/2
C#
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.

Parameters
NameTypeDefault
fromstring—
from

Source text. An empty string and, in the current SDK, null produce an empty name.

Returns StringName

New StringName wrapper, including a distinct empty wrapper for empty input.

op_Inequality3 overloads
# op_Inequality · 1/3
C#
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.

Parameters
NameTypeDefault
leftReckfell.NativeInterop.reckfell_string_name—
rightStringName—
left

Valid native name; default is empty. Its lifetime must cover the call.

right

Managed wrapper or null; null corresponds to an empty native name.

Returns bool

true for differing native identities under the stated null rule; otherwise false.

# op_Inequality · 2/3
C#
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.

Parameters
NameTypeDefault
leftStringName—
rightReckfell.NativeInterop.reckfell_string_name—
left

Managed wrapper or null; null corresponds to an empty native name.

right

Valid native name; default is empty. Its lifetime must cover the call.

Returns bool

true for differing native identities under the stated null rule; otherwise false.

# op_Inequality · 3/3
C#
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.

Parameters
NameTypeDefault
leftStringName—
rightStringName—
left

Managed wrapper to compare, or null.

right

Managed wrapper to compare, or null.

Returns bool

true if the names or null state differ; otherwise false.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.