Summary
A
string
wrapper which allows fast reference equality checks and dictionary usage
by ensuring that users of identical strings are given the same Animancer.StringReference
instead of needing to compare each character in the strings.
- Assembly
- Animancer
.dll - Namespace
- Animancer
- Interfaces
-
- IComparable
<StringReference> - IConvertable
<string>
- IComparable
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IComparable<StringReference>"]
Type-.->Interface1["IConvertable<string>"]
Type["StringReference"]
class Type type-node
Syntax
public class StringReference : IComparable<StringReference>, IConvertable<string>
Remarks
Rather than a constructor, instances of this class are acquired via
Animancer.StringReference.Get(System.String)
or via implicit conversion from string
(which calls the same method).
Unlike UnityEngine.InputSystem.Utilities.InternedString
,
this implementation is case-sensitive and treats null
and ""
as not equal.
It's also a class to allow usage as a key in a dictionary keyed by System.Object
without boxing.
Example:
public static readonly StringReference MyStringReference = "My String";
Fields
Methods
Name | Value | Summary |
---|---|---|
CompareTo |
int |
Compares the
Animancer.StringReference.String s. |
Get |
StringReference |
Returns a
Animancer.StringReference containing the `value`.static
|
Get |
StringReference[] |
Creates a new array of
Animancer.StringReference s to the `strings`.static
|
ToString |
string |
Returns the
Animancer.StringReference.String . |
TryGet |
bool |
Returns a
Animancer.StringReference containing the `value` if one has already been created.static
|
Operators
Name | Value | Summary |
---|---|---|
implicit operator string |
string | |
implicit operator |
StringReference |
Extension Methods
Name | Value | Summary |
---|---|---|
Equals |
bool |
Is the
Animancer.StringReference.String equal to the `other`
when treating "" as equal to null ?
|
IsNullOrEmpty |
bool |
Is the `reference`
null or its Animancer.StringReference.String empty? |