Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Reuse the same tag separator array
Browse files Browse the repository at this point in the history
We're targeting netstandard2.0 and don't have ReadOnlySpan or any of the new APIs that avoid allocating
  • Loading branch information
Therzok committed Feb 20, 2023
1 parent 3550ded commit 25cb1aa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Xwt/Xwt.Drawing/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@ class ImageTagSet
string[] tagsArray;

public static readonly ImageTagSet Empty = new ImageTagSet (new string[0]);
static readonly char[] tagSeparators = { '~' };

public ImageTagSet (string [] tagsArray)
{
Expand All @@ -988,7 +989,7 @@ public bool IsEmpty {

public ImageTagSet (string tags)
{
tagsArray = tags.Split (new [] { '~' }, StringSplitOptions.RemoveEmptyEntries);
tagsArray = tags.Split (tagSeparators, StringSplitOptions.RemoveEmptyEntries);
Array.Sort (AsArray);
}

Expand Down

0 comments on commit 25cb1aa

Please sign in to comment.