Skip to content

Commit 35e6604

Browse files
committed
Misc optimizations
1 parent 77f30dd commit 35e6604

File tree

14 files changed

+21
-21
lines changed

14 files changed

+21
-21
lines changed

src/Skybrud.Umbraco.GridData/Extensions/TypedGridExtensionMethods.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static class TypedGridExtensionMethods {
2222

2323
/// <summary>
2424
/// Returns a <see cref="GridDataModel"/> instance representing the value of the property with the specified
25-
/// <paramref name="propertyAlias"/>. If the property doesn't exist or it's value doesn't match a
25+
/// <paramref name="propertyAlias"/>. If the property doesn't exist, or it's value doesn't match a
2626
/// <see cref="GridDataModel"/> instance, a <see cref="GridDataModel"/> instance representing an empty grid
2727
/// model is returned instead.
2828
/// </summary>
@@ -34,7 +34,7 @@ public static GridDataModel GetGridModel(this IPublishedContent? content, string
3434

3535
/// <summary>
3636
/// Returns a <see cref="GridDataModel"/> instance representing the value of the property with the specified
37-
/// <paramref name="propertyAlias"/>. If the property doesn't exist or it's value doesn't match a
37+
/// <paramref name="propertyAlias"/>. If the property doesn't exist, or it's value doesn't match a
3838
/// <see cref="GridDataModel"/> instance, <see langword="null"/> is returned instead.
3939
/// </summary>
4040
/// <param name="content">The parent content item.</param>

src/Skybrud.Umbraco.GridData/Manifests/GridManifestFilter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class GridManifestFilter : IManifestFilter {
1010
public void Filter(List<PackageManifest> manifests) {
1111
manifests.Add(new PackageManifest {
1212
AllowPackageTelemetry = true,
13+
PackageId = GridPackage.Alias,
1314
PackageName = GridPackage.Name,
1415
Version = GridPackage.InformationalVersion
1516
});

src/Skybrud.Umbraco.GridData/Models/GridArea.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public GridArea(JObject json, GridRow row, IGridFactory factory) : base(json) {
105105
Grid = json.GetInt32("grid");
106106
AllowAll = json.GetBoolean("allowAll");
107107
Allowed = json.GetStringArray("allowed");
108-
Controls = json.GetArray("controls", x => factory.CreateGridControl(x, this)) ?? Array.Empty<GridControl>();
108+
Controls = json.GetArray("controls", x => factory.CreateGridControl(x, this)) ?? [];
109109

110110
// Update "PreviousControl" and "NextControl" properties
111111
for (int i = 1; i < Controls.Count; i++) {

src/Skybrud.Umbraco.GridData/Models/GridControl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ internal GridControl(GridControl control) : base(control.JObject) {
9494
#region Member methods
9595

9696
/// <summary>
97-
/// Returns the value of the control casted to the type of <typeparamref name="T"/>.
97+
/// Returns the value of the control cast to the type of <typeparamref name="T"/>.
9898
/// </summary>
9999
/// <typeparam name="T">The type of the value to be returned.</typeparam>
100100
public T? GetValue<T>() where T : IGridControlValue {
@@ -111,7 +111,7 @@ public void WriteSearchableText(GridContext context, TextWriter writer) {
111111
}
112112

113113
/// <summary>
114-
/// Returns the value of the control as a searchable text - eg. to be used in Examine.
114+
/// Returns the value of the control as a searchable text - e.g. to be used in Examine.
115115
/// </summary>
116116
/// <param name="context">The current grid context.</param>
117117
/// <returns>An instance of <see cref="string"/> with the value as a searchable text.</returns>

src/Skybrud.Umbraco.GridData/Models/GridDataModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ public bool IsValid {
8181
Name = json.GetString("name")!;
8282

8383
if (factory is null) {
84-
Sections = Array.Empty<GridSection>();
84+
Sections = [];
8585
} else {
86-
Sections = json.GetArray("sections", x => factory.CreateGridSection(x, this)) ?? Array.Empty<GridSection>();
86+
Sections = json.GetArray("sections", x => factory.CreateGridSection(x, this)) ?? [];
8787
}
8888

8989
}
@@ -138,7 +138,7 @@ public void WriteSearchableText(GridContext context, TextWriter writer) {
138138
}
139139

140140
/// <summary>
141-
/// Returns a textual representation of the grid model - eg. to be used in Examine.
141+
/// Returns a textual representation of the grid model - e.g. to be used in Examine.
142142
/// </summary>
143143
/// <param name="context">The current grid context.</param>
144144
/// <returns>An instance of <see cref="string"/> representing the value of the element.</returns>

src/Skybrud.Umbraco.GridData/Models/GridDictionary.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public class GridDictionary : GridJsonObject, IEnumerable<GridDictionaryItem> {
2525
/// Gets the keys of the underlying dictionary.
2626
/// </summary>
2727
[JsonIgnore]
28-
public string[] Keys => _dictionary.Keys.ToArray();
28+
public string[] Keys => [.. _dictionary.Keys];
2929

3030
/// <summary>
3131
/// Gets the keys of the underlying dictionary.
3232
/// </summary>
3333
[JsonIgnore]
34-
public string[] Values => _dictionary.Keys.ToArray();
34+
public string[] Values => [.. _dictionary.Keys];
3535

3636
/// <summary>
3737
/// Gets the amount of items in the dictionary.

src/Skybrud.Umbraco.GridData/Models/GridEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public GridEditor(GridEditor editor) : base(editor.JObject) {
9494
#region Member methods
9595

9696
/// <summary>
97-
/// Returns the config of the editor casted to the type of <typeparamref name="T"/>.
97+
/// Returns the config of the editor cast to the type of <typeparamref name="T"/>.
9898
/// </summary>
9999
/// <typeparam name="T">The type of the config to be returned.</typeparam>
100100
public T? GetConfig<T>() where T : IGridEditorConfig {

src/Skybrud.Umbraco.GridData/Models/GridElement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected GridElement(JObject json) : base(json) {
6262
public abstract void WriteSearchableText(GridContext context, TextWriter writer);
6363

6464
/// <summary>
65-
/// Gets a textual representation of the element - eg. to be used in Examine.
65+
/// Gets a textual representation of the element - e.g. to be used in Examine.
6666
/// </summary>
6767
/// <param name="context">The current grid context.</param>
6868
/// <returns>An instance of <see cref="string"/> representing the value of the element.</returns>

src/Skybrud.Umbraco.GridData/Models/GridRow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public GridRow(JObject json, GridSection section, IGridFactory factory) : base(j
9494
Label = json.GetString("label");
9595
Name = json.GetString("name")!;
9696

97-
Areas = json.GetArray("areas", x => factory.CreateGridArea(x, this)) ?? Array.Empty<GridArea>();
97+
Areas = json.GetArray("areas", x => factory.CreateGridArea(x, this)) ?? [];
9898

9999
// Update "PreviousArea" and "NextArea" properties
100100
for (int i = 1; i < Areas.Count; i++) {

src/Skybrud.Umbraco.GridData/Models/GridSection.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.IO;
43
using System.Linq;
54
using System.Text;
@@ -66,7 +65,7 @@ public GridSection(JObject json, GridDataModel grid, IGridFactory factory) : bas
6665
Model = grid;
6766
Grid = json.GetInt32("grid");
6867
Name = grid.Name;
69-
Rows = json.GetArray("rows", x => factory.CreateGridRow(x, this)) ?? Array.Empty<GridRow>();
68+
Rows = json.GetArray("rows", x => factory.CreateGridRow(x, this)) ?? [];
7069

7170
// Update "PreviousRow" and "NextRow" properties
7271
for (int i = 1; i < Rows.Count; i++) {
@@ -90,7 +89,7 @@ public void WriteSearchableText(GridContext context, TextWriter writer) {
9089
}
9190

9291
/// <summary>
93-
/// Returns a textual representation of the section - eg. to be used in Examine.
92+
/// Returns a textual representation of the section - e.g. to be used in Examine.
9493
/// </summary>
9594
/// <param name="context">The current grid context.</param>
9695
/// <returns>An instance of <see cref="string"/> representing the value of the element.</returns>

0 commit comments

Comments
 (0)