diff --git a/OmegaLeo.HelperLib/Helpers/BenchmarkUtility.cs b/OmegaLeo.HelperLib/Helpers/BenchmarkUtility.cs index 6635a40..99fb7d8 100755 --- a/OmegaLeo.HelperLib/Helpers/BenchmarkUtility.cs +++ b/OmegaLeo.HelperLib/Helpers/BenchmarkUtility.cs @@ -5,30 +5,19 @@ using OmegaLeo.HelperLib.Shared.Attributes; namespace OmegaLeo.HelperLib.Helpers { - /// - /// Utility class for benchmarking code execution time. - /// -[Documentation(nameof(BenchmarkUtility), "Utility class for benchmarking code execution time.", null, @"```csharp + [Documentation(nameof(BenchmarkUtility), "Utility class for benchmarking code execution time.", null, @"```csharp BenchmarkUtility.Start(""MyBenchmark""); // Code to benchmark BenchmarkUtility.Stop(""MyBenchmark""); var results = BenchmarkUtility.GetResults(""MyBenchmark""); ```")] [Changelog("1.2.0", "Fixed root namespace to OmegaLeo.HelperLib.Helpers.", "January 28, 2026")] - /// - /// Utility class for benchmarking code execution time. - /// public class BenchmarkUtility { private static Dictionary> _benchmarks = new Dictionary>(); private static Dictionary _stopwatches = new Dictionary(); - /// - /// Retrieves or creates a Stopwatch instance for the given key. - /// - /// The key parameter - /// The return value -[Documentation("GetStopwatch", "Retrieves or creates a Stopwatch instance for the given key.", null, null)] + [Documentation("GetStopwatch", "Retrieves or creates a Stopwatch instance for the given key.", null, null)] private static Stopwatch GetStopwatch(string key) { Stopwatch stopwatch; @@ -42,12 +31,7 @@ var results = BenchmarkUtility.GetResults(""MyBenchmark""); return stopwatch; } - /// - /// Records the execution time of the provided action and returns the elapsed time in milliseconds. - /// - /// The actionToRecord parameter - /// The return value -[Documentation("Record", "Records the execution time of the provided action and returns the elapsed time in milliseconds.", null, @"```csharp + [Documentation("Record", "Records the execution time of the provided action and returns the elapsed time in milliseconds.", null, @"```csharp var time = BenchmarkUtility.Record(() => { // Code to benchmark @@ -66,13 +50,7 @@ Console.WriteLine($""Elapsed time: {time} ms""); return stopwatch.ElapsedMilliseconds; } - /// - /// Records the execution time of the provided action, saves it under the given key, and returns the elapsed time in milliseconds. - /// - /// The key parameter - /// The actionToRecord parameter - /// The return value -[Documentation("RecordAndSaveToResults", "Records the execution time of the provided action, saves it under the given key, and returns the elapsed time in milliseconds.", null, @"```csharp + [Documentation("RecordAndSaveToResults", "Records the execution time of the provided action, saves it under the given key, and returns the elapsed time in milliseconds.", null, @"```csharp var time = BenchmarkUtility.RecordAndSaveToResults(""MyBenchmark"", () => { // Code to benchmark @@ -104,29 +82,13 @@ Console.WriteLine($""Average time: {averageTime} ms""); return stopwatch.ElapsedMilliseconds; } - /// - /// Starts or restarts the stopwatch for the given key. - /// - /// The key parameter -[Documentation("Start", "Starts or restarts the stopwatch for the given key.", null, null)] - /// - /// Starts or restarts the stopwatch for the given key. - /// - /// The benchmark identifier + [Documentation("Start", "Starts or restarts the stopwatch for the given key.", null, null)] public static void Start(string key) { GetStopwatch(key).Restart(); } - /// - /// Stops the stopwatch for the given key and records the elapsed time. - /// - /// The key parameter -[Documentation("Stop", "Stops the stopwatch for the given key and records the elapsed time.", null, null)] - /// - /// Stops the stopwatch for the given key and records the elapsed time. - /// - /// The benchmark identifier + [Documentation("Stop", "Stops the stopwatch for the given key and records the elapsed time.", null, null)] public static void Stop(string key) { if (!_benchmarks.ContainsKey(key)) @@ -138,36 +100,19 @@ Console.WriteLine($""Average time: {averageTime} ms""); _benchmarks[key].Add(GetStopwatch(key).ElapsedMilliseconds); } - /// - /// Retrieves the list of recorded times for the given key. - /// - /// The key parameter - /// The return value -[Documentation("GetResults", "Retrieves the list of recorded times for the given key.", null, null)] - /// - /// Retrieves the list of recorded times for the given key. - /// - /// The benchmark identifier - /// List of recorded times in milliseconds + [Documentation("GetResults", "Retrieves the list of recorded times for the given key.", null, null)] public static List GetResults(string key) { return _benchmarks.ContainsKey(key) ? _benchmarks[key] : new List(); } - /// - /// Clears all recorded benchmark results. - /// -[Documentation("ClearResults", "Clears all recorded benchmark results.", null, null)] + [Documentation("ClearResults", "Clears all recorded benchmark results.", null, null)] public static void ClearResults() { _benchmarks.Clear(); } - /// - /// Retrieves all recorded benchmark results. - /// - /// The return value -[Documentation("GetAllResults", "Retrieves all recorded benchmark results.", null, null)] + [Documentation("GetAllResults", "Retrieves all recorded benchmark results.", null, null)] public static Dictionary> GetAllResults() { return new Dictionary>(_benchmarks); diff --git a/OmegaLeo.HelperLib/Models/NeoDictionary.cs b/OmegaLeo.HelperLib/Models/NeoDictionary.cs index aee3651..3297bf6 100755 --- a/OmegaLeo.HelperLib/Models/NeoDictionary.cs +++ b/OmegaLeo.HelperLib/Models/NeoDictionary.cs @@ -10,11 +10,6 @@ namespace OmegaLeo.HelperLib.Models [Serializable] [Documentation("NeoDictionary", "Dictionary like class created to make it easier to display dictionaries in game engines like Unity")] [Changelog("1.2.0", "Fixed root namespace to OmegaLeo.HelperLib.Models.", "January 28, 2026")] - /// - /// Dictionary like class created to make it easier to display dictionaries in game engines like Unity. - /// - /// The type of keys in the dictionary - /// The type of values in the dictionary public class NeoDictionary { public List> Items = new List>(); @@ -28,12 +23,6 @@ namespace OmegaLeo.HelperLib.Models : new Dictionary(); [Documentation("TryGetValue", "Tries to get the value from the NeoDictionary for the given key.")] - /// - /// Tries to get the value from the NeoDictionary for the given key. - /// - /// The key to search for - /// The value associated with the key, if found - /// True if the key was found, false otherwise public bool TryGetValue(TKey key, out TValue value) { var item = Items.FirstOrDefault(x => x.Key.Equals(key)); @@ -50,12 +39,6 @@ namespace OmegaLeo.HelperLib.Models } [Documentation("TryGetValueFromIndex", "Tries to get the value from the NeoDictionary at the given index.")] - /// - /// Tries to get the value from the NeoDictionary at the given index. - /// - /// The zero-based index of the element - /// The value at the specified index, if found - /// True if the index is valid, false otherwise public bool TryGetValueFromIndex(int index, out TValue value) { if (index < Items.Count) @@ -75,11 +58,6 @@ namespace OmegaLeo.HelperLib.Models } [Documentation("Add", "Adds a new NeoDictionaryItem to the NeoDictionary.")] - /// - /// Adds a new NeoDictionaryItem to the NeoDictionary. - /// - /// The key of the element to add - /// The value of the element to add public void Add(TKey key, TValue value) { Items.Add(new NeoDictionaryItem(key, value));