Class StringTag
Namespace: Void.Minecraft.Nbt
Assembly: Void.Minecraft.dll
A tag the contains a UTF-8 string.
public class StringTag : Tag, IEquatable<Tag>, ICloneable, IEquatable<StringTag>Inheritance
Implements
IEquatable<Tag>, ICloneable, IEquatable<StringTag>
Inherited Members
Tag.NoName, Tag.Type, Tag.Parent, Tag.Name, Tag.PrettyPrinted(StringBuilder, int, string), Tag.PrettyName, Tag.WriteJson(Utf8JsonWriter, bool), Tag.WriteJson(Stream, JsonWriterOptions?), Tag.WriteJsonAsync(Stream, JsonWriterOptions?), Tag.ToJson(JsonWriterOptions?), Tag.ToJsonString(bool, string), Tag.Equals(Tag?), Tag.Equals(object?), Tag.GetHashCode(), Tag.Clone(), Tag.Stringify(bool), Tag.StringifyName, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
StringTag(string?, string?)
Creates a new instance of the value.
public StringTag(string? name, string? value)Parameters
name string?
The name of the tag, or null if tag has no name.
value string?
The value to assign to this tag.
Properties
Value
Gets or sets the value of the tag.
public string Value { get; set; }Property Value
Methods
Equals(StringTag?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(StringTag? other)Parameters
other StringTag?
An object to compare with this object.
Returns
true if the current object is equal to the other parameter; otherwise, false.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)Parameters
obj object?
The object to compare with the current object.
Returns
true if the specified object is equal to the current object; otherwise, false.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()Returns
A hash code for the current object.
Stringify(bool)
Gets the string representation of this NBT tag (SNBT).
public override string Stringify(bool named = true)Parameters
named bool
Flag indicating if the name of the tag should be written.
Returns
This NBT tag in SNBT format.
See Also
https://minecraft.fandom.com/wiki/NBT_format#SNBT_format
ToString()
Returns a string that represents the current object.
public override string ToString()Returns
A string that represents the current object.
WriteJson(Utf8JsonWriter, bool)
Uses the provided writer to write the NBT tag in JSON format.
protected override void WriteJson(Utf8JsonWriter writer, bool named = true)Parameters
writer Utf8JsonWriter
A JSON writer instance.
named bool
Flag indicating if this object’s name should be written as a property name, or false when it
is a child of
Operators
operator ==(StringTag?, StringTag?)
Compares two values to determine equality.
public static bool operator ==(StringTag? left, StringTag? right)Parameters
left StringTag?
The value to compare with right.
right StringTag?
The value to compare with left.
Returns
true if left is equal to right; otherwise, false.
implicit operator string(StringTag)
Implicit conversion of this tag to a
public static implicit operator string(StringTag tag)Parameters
tag StringTag
The tag to convert.
Returns
The tag represented as a
operator !=(StringTag?, StringTag?)
Compares two values to determine inequality.
public static bool operator !=(StringTag? left, StringTag? right)Parameters
left StringTag?
The value to compare with right.
right StringTag?
The value to compare with left.