Table of Contents

Class StringName

Namespace
Godot
Assembly
GodotSharp.dll

StringNames are immutable strings designed for general-purpose representation of unique names. StringName ensures that only one instance of a given name exists (so two StringNames with the same value are the same object). Comparing them is much faster than with regular strings, because only the pointers are compared, not the whole strings.

public sealed class StringName : IDisposable, IEquatable<StringName>
Inheritance
StringName
Implements
Inherited Members

Constructors

StringName()

Constructs an empty StringName.

public StringName()

StringName(string)

Constructs a StringName from the given name string.

public StringName(string name)

Parameters

name string

String to construct the StringName from.

Properties

IsEmpty

Check whether this StringName is empty.

public bool IsEmpty { get; }

Property Value

bool

If the StringName is empty.

Methods

Dispose()

Disposes of this StringName.

public void Dispose()

Dispose(bool)

public void Dispose(bool disposing)

Parameters

disposing bool

Equals(in godot_string_name)

public bool Equals(in godot_string_name other)

Parameters

other godot_string_name

Returns

bool

Equals(StringName)

public bool Equals(StringName other)

Parameters

other StringName

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

~StringName()

protected ~StringName()

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

Converts this StringName to a string.

public override string ToString()

Returns

string

A string representation of this StringName.

Operators

operator ==(in godot_string_name, StringName)

public static bool operator ==(in godot_string_name left, StringName right)

Parameters

left godot_string_name
right StringName

Returns

bool

operator ==(StringName, in godot_string_name)

public static bool operator ==(StringName left, in godot_string_name right)

Parameters

left StringName
right godot_string_name

Returns

bool

operator ==(StringName, StringName)

public static bool operator ==(StringName left, StringName right)

Parameters

left StringName
right StringName

Returns

bool

implicit operator string(StringName)

Converts a StringName to a string.

public static implicit operator string(StringName from)

Parameters

from StringName

The StringName to convert.

Returns

string

implicit operator StringName(string)

Converts a string to a StringName.

public static implicit operator StringName(string from)

Parameters

from string

The string to convert.

Returns

StringName

operator !=(in godot_string_name, StringName)

public static bool operator !=(in godot_string_name left, StringName right)

Parameters

left godot_string_name
right StringName

Returns

bool

operator !=(StringName, in godot_string_name)

public static bool operator !=(StringName left, in godot_string_name right)

Parameters

left StringName
right godot_string_name

Returns

bool

operator !=(StringName, StringName)

public static bool operator !=(StringName left, StringName right)

Parameters

left StringName
right StringName

Returns

bool