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
- namestring
- 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
- disposingbool
Equals(in godot_string_name)
public bool Equals(in godot_string_name other)Parameters
- othergodot_string_name
Returns
Equals(StringName)
public bool Equals(StringName other)Parameters
- otherStringName
Returns
Equals(object)
public override bool Equals(object obj)Parameters
- objobject
Returns
~StringName()
protected ~StringName()GetHashCode()
public override int GetHashCode()Returns
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
- leftgodot_string_name
- rightStringName
Returns
operator ==(StringName, in godot_string_name)
public static bool operator ==(StringName left, in godot_string_name right)Parameters
- leftStringName
- rightgodot_string_name
Returns
operator ==(StringName, StringName)
public static bool operator ==(StringName left, StringName right)Parameters
- leftStringName
- rightStringName
Returns
implicit operator string(StringName)
Converts a StringName to a string.
public static implicit operator string(StringName from)Parameters
- fromStringName
- The StringName to convert. 
Returns
implicit operator StringName(string)
Converts a string to a StringName.
public static implicit operator StringName(string from)Parameters
- fromstring
- The string to convert. 
Returns
operator !=(in godot_string_name, StringName)
public static bool operator !=(in godot_string_name left, StringName right)Parameters
- leftgodot_string_name
- rightStringName
Returns
operator !=(StringName, in godot_string_name)
public static bool operator !=(StringName left, in godot_string_name right)Parameters
- leftStringName
- rightgodot_string_name
Returns
operator !=(StringName, StringName)
public static bool operator !=(StringName left, StringName right)Parameters
- leftStringName
- rightStringName