mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Replaced AsReadOnly property getters with regular properties
Should reduce allocations
This commit is contained in:
1 parent
7ad7eaad89
commit
0b370f261c
21 files changed
+84
-42
No files matched your search
@@ -26,6 +26,9 @@ namespace Artemis.Core.Modules
|
||||
// These are both set right after construction to keep the constructor of inherited classes clean
|
||||
Module = null!;
|
||||
DataModelDescription = null!;
|
||||
|
||||
ActivePaths = new(_activePaths);
|
||||
DynamicChildren = new(_dynamicChildren);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -52,13 +55,13 @@ namespace Artemis.Core.Modules
|
||||
/// Gets an read-only dictionary of all dynamic children
|
||||
/// </summary>
|
||||
[DataModelIgnore]
|
||||
public ReadOnlyDictionary<string, DynamicChild> DynamicChildren => new(_dynamicChildren);
|
||||
public ReadOnlyDictionary<string, DynamicChild> DynamicChildren { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a read-only list of <see cref="DataModelPath" />s targeting this data model
|
||||
/// </summary>
|
||||
[DataModelIgnore]
|
||||
public ReadOnlyCollection<DataModelPath> ActivePaths => _activePaths.AsReadOnly();
|
||||
public ReadOnlyCollection<DataModelPath> ActivePaths { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a read-only collection of all properties in this datamodel that are to be ignored
|
||||
|
||||
@@ -114,6 +114,12 @@ namespace Artemis.Core.Modules
|
||||
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new();
|
||||
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
|
||||
|
||||
public Module()
|
||||
{
|
||||
DefaultProfilePaths = new ReadOnlyCollection<(DefaultCategoryName, string)>(_defaultProfilePaths);
|
||||
HiddenProperties = new(HiddenPropertiesList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
||||
/// </summary>
|
||||
@@ -122,7 +128,7 @@ namespace Artemis.Core.Modules
|
||||
/// <summary>
|
||||
/// Gets a read only collection of default profile paths
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<(DefaultCategoryName, string)> DefaultProfilePaths => _defaultProfilePaths.AsReadOnly();
|
||||
public IReadOnlyCollection<(DefaultCategoryName, string)> DefaultProfilePaths { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of activation requirements
|
||||
@@ -176,7 +182,7 @@ namespace Artemis.Core.Modules
|
||||
/// <summary>
|
||||
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly();
|
||||
public ReadOnlyCollection<PropertyInfo> HiddenProperties { get; }
|
||||
|
||||
internal DataModel? InternalDataModel { get; set; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user