diff --git a/SharpNBT/Tags/CompoundTag.cs b/SharpNBT/Tags/CompoundTag.cs index 796ee13..42586df 100644 --- a/SharpNBT/Tags/CompoundTag.cs +++ b/SharpNBT/Tags/CompoundTag.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Runtime.Serialization; using System.Text; using JetBrains.Annotations; @@ -69,7 +68,7 @@ namespace SharpNBT { foreach (var tag in this) { - if (name.Equals(tag.Name)) + if (string.CompareOrdinal(name, tag.Name) == 0) return tag; if (deep && tag is CompoundTag child) @@ -83,6 +82,13 @@ namespace SharpNBT return null; } + /// + /// Retrieves a child tag with the specified , or if no match was found. + /// + /// The name of the tag to retrieve. + [CanBeNull] + public Tag this[[NotNull] string name] => Find(name, false); + /// protected internal override void PrettyPrinted(StringBuilder buffer, int level, string indent) {