From 2a9d55341b64939f313ca3dfdbf19a465d2e11db Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Sun, 21 Jul 2024 00:08:54 +0100 Subject: [PATCH] Fix documentation --- Src/CrispyWaffle/Utilities/LazyResettable.cs | 57 +++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/Src/CrispyWaffle/Utilities/LazyResettable.cs b/Src/CrispyWaffle/Utilities/LazyResettable.cs index 18a9c9df..5bfcdde1 100644 --- a/Src/CrispyWaffle/Utilities/LazyResettable.cs +++ b/Src/CrispyWaffle/Utilities/LazyResettable.cs @@ -6,8 +6,7 @@ namespace CrispyWaffle.Utilities { /// - /// The resettable lazy class. - /// This class is based on https://stackoverflow.com/a/6255398/1890220 + /// The resettable lazy class. This class is based on https://stackoverflow.com/a/6255398/1890220. /// /// /// @@ -18,50 +17,65 @@ namespace CrispyWaffle.Utilities public class LazyResettable : ILazyResettable { /// - /// The internal class box + /// The internal class box. /// /// private sealed class Box { /// - /// The value + /// The value. /// public readonly T Value; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The value. public Box(T value) => Value = value; } /// - /// The mode + /// The mode. /// private readonly LazyThreadSafetyMode _mode; /// - /// The value factory + /// The value factory. /// private readonly Func _valueFactory; /// - /// The synchronize lock + /// The synchronize lock. /// private readonly object _syncLock = new object(); /// - /// The box + /// The box. /// private Box _box; + /// + /// The loads. + /// public int Loads; + + /// + /// The hits. + /// public int Hits; + + /// + /// The resets. + /// public int Resets; + + /// + /// The sum load time. + /// public TimeSpan SumLoadTime; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The value factory. /// The mode. @@ -78,6 +92,9 @@ public LazyResettable( DeclaringType = declaringType ?? valueFactory.Method.DeclaringType; } + /// + /// Occurs when [on reset]. + /// public event EventHandler OnReset; /// @@ -112,11 +129,13 @@ public void Load() /// /// Gets the type of the declaring. /// - /// - /// The type of the declaring. - /// + /// The type of the declaring. public Type DeclaringType { get; } + /// + /// Stats this instance. + /// + /// ResetLazyStats. public ResetLazyStats Stats() => new ResetLazyStats(typeof(T)) { @@ -129,9 +148,7 @@ public ResetLazyStats Stats() => /// /// Gets the value. /// - /// - /// The value. - /// + /// The value. public T Value { get @@ -181,11 +198,13 @@ public T Value /// /// Gets a value indicating whether this instance is value created. /// - /// - /// true if this instance is value created; otherwise, false. - /// + /// true if this instance is value created; otherwise, false. public bool IsValueCreated => _box != null; + /// + /// Internals the loaded. + /// + /// T. private T InternalLoaded() { var sw = Stopwatch.StartNew();