Avoid allocating new empty arrays, reuse existing empty array

This commit is contained in:
Henrik Gedionsen
2025-03-31 14:12:54 +02:00
committed by Sebastiaan Janssen
parent 4239f0fc06
commit 822c8374ef
6 changed files with 14 additions and 14 deletions

View File

@@ -53,8 +53,8 @@ public class User : EntityBase, IUser, IProfile
_language = globalSettings.DefaultUILanguage;
_isApproved = true;
_isLockedOut = false;
_startContentIds = new int[] { };
_startMediaIds = new int[] { };
_startContentIds = [];
_startMediaIds = [];
// cannot be null
_rawPasswordValue = string.Empty;
@@ -101,8 +101,8 @@ public class User : EntityBase, IUser, IProfile
_userGroups = new HashSet<IReadOnlyUserGroup>();
_isApproved = true;
_isLockedOut = false;
_startContentIds = new int[] { };
_startMediaIds = new int[] { };
_startContentIds = [];
_startMediaIds = [];
}
/// <summary>