diff --git a/src/DynamicData.Tests/Domain/Animal.cs b/src/DynamicData.Tests/Domain/Animal.cs index 983cde9a5..b97f6a6ee 100644 --- a/src/DynamicData.Tests/Domain/Animal.cs +++ b/src/DynamicData.Tests/Domain/Animal.cs @@ -19,7 +19,7 @@ public enum AnimalFamily Bird } -public class Animal(string name, string type, AnimalFamily family, bool include = true, int? id = null) : AbstractNotifyPropertyChanged +public sealed class Animal(string name, string type, AnimalFamily family, bool include = true, int? id = null) : AbstractNotifyPropertyChanged { private static int s_counter; @@ -46,7 +46,7 @@ public bool IncludeInResults public override int GetHashCode() => HashCode.Combine(Id, Name, Family, Type); } -public class AnimalEqualityComparer : IEqualityComparer +public sealed class AnimalEqualityComparer : IEqualityComparer { public static AnimalEqualityComparer Instance { get; } = new(); diff --git a/src/DynamicData.Tests/Domain/AnimalOwner.cs b/src/DynamicData.Tests/Domain/AnimalOwner.cs index b960fec87..08925128c 100644 --- a/src/DynamicData.Tests/Domain/AnimalOwner.cs +++ b/src/DynamicData.Tests/Domain/AnimalOwner.cs @@ -3,7 +3,7 @@ namespace DynamicData.Tests.Domain; -internal class AnimalOwner(string name, Guid? id = null, bool include = true) : AbstractNotifyPropertyChanged, IDisposable +internal sealed class AnimalOwner(string name, Guid? id = null, bool include = true) : AbstractNotifyPropertyChanged, IDisposable { private bool _includeInResults = include; diff --git a/src/DynamicData.Tests/Domain/Market.cs b/src/DynamicData.Tests/Domain/Market.cs index b7c23b76a..4422df07a 100644 --- a/src/DynamicData.Tests/Domain/Market.cs +++ b/src/DynamicData.Tests/Domain/Market.cs @@ -19,7 +19,7 @@ internal interface IMarket public IObservable> LatestPrices { get; } } -internal class Market : IMarket, IDisposable +internal sealed class Market : IMarket, IDisposable { private readonly ISourceCache _latestPrices = new SourceCache(p => p.ItemId); @@ -108,7 +108,7 @@ public int Compare([DisallowNull] IMarket x, [DisallowNull] IMarket y) => } -internal class FixedMarket : IMarket +internal sealed class FixedMarket : IMarket { public FixedMarket(Func getPrice, int minId, int maxId, bool completable = true) { diff --git a/src/DynamicData.Tests/Domain/MarketPrice.cs b/src/DynamicData.Tests/Domain/MarketPrice.cs index 05dfaa97b..e88845af5 100644 --- a/src/DynamicData.Tests/Domain/MarketPrice.cs +++ b/src/DynamicData.Tests/Domain/MarketPrice.cs @@ -5,7 +5,7 @@ namespace DynamicData.Tests.Domain; -internal class MarketPrice +internal sealed class MarketPrice { public static IEqualityComparer EqualityComparer { get; } = new CurrentPriceEqualityComparer(); public static IEqualityComparer EqualityComparerWithTimeStamp { get; } = new TimeStampPriceEqualityComparer(); diff --git a/src/DynamicData.Tests/Utilities/ComparerExtensions.cs b/src/DynamicData.Tests/Utilities/ComparerExtensions.cs index 9bace663b..f14dc74d2 100644 --- a/src/DynamicData.Tests/Utilities/ComparerExtensions.cs +++ b/src/DynamicData.Tests/Utilities/ComparerExtensions.cs @@ -4,19 +4,19 @@ namespace DynamicData.Tests.Utilities; -internal class NoOpComparer : IComparer +internal sealed class NoOpComparer : IComparer { public int Compare(T x, T y) => throw new NotImplementedException(); } -internal class NoOpEqualityComparer : IEqualityComparer +internal sealed class NoOpEqualityComparer : IEqualityComparer { public bool Equals(T x, T y) => throw new NotImplementedException(); public int GetHashCode([DisallowNull] T obj) => throw new NotImplementedException(); } -internal class InvertedComparer(IComparer original) : IComparer +internal sealed class InvertedComparer(IComparer original) : IComparer { private readonly IComparer _original = original; diff --git a/src/DynamicData/Aggregation/AggregateEnumerator.cs b/src/DynamicData/Aggregation/AggregateEnumerator.cs index 6cebcf69d..35e18f707 100644 --- a/src/DynamicData/Aggregation/AggregateEnumerator.cs +++ b/src/DynamicData/Aggregation/AggregateEnumerator.cs @@ -8,7 +8,7 @@ namespace DynamicData.Aggregation; -internal class AggregateEnumerator(IChangeSet source) : IAggregateChangeSet +internal sealed class AggregateEnumerator(IChangeSet source) : IAggregateChangeSet where T : notnull { public IEnumerator> GetEnumerator() @@ -54,7 +54,7 @@ public IEnumerator> GetEnumerator() } [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Same name, different generics.")] -internal class AggregateEnumerator(IChangeSet source) : IAggregateChangeSet +internal sealed class AggregateEnumerator(IChangeSet source) : IAggregateChangeSet where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Binding/ObservablePropertyFactory.cs b/src/DynamicData/Binding/ObservablePropertyFactory.cs index 4594fbb59..4def718ed 100644 --- a/src/DynamicData/Binding/ObservablePropertyFactory.cs +++ b/src/DynamicData/Binding/ObservablePropertyFactory.cs @@ -9,7 +9,7 @@ namespace DynamicData.Binding; -internal class ObservablePropertyFactory +internal sealed class ObservablePropertyFactory where TObject : INotifyPropertyChanged { private readonly Func>> _factory; diff --git a/src/DynamicData/Cache/DistinctChangeSet.cs b/src/DynamicData/Cache/DistinctChangeSet.cs index 85df7c997..1717e8788 100644 --- a/src/DynamicData/Cache/DistinctChangeSet.cs +++ b/src/DynamicData/Cache/DistinctChangeSet.cs @@ -5,7 +5,7 @@ // ReSharper disable once CheckNamespace namespace DynamicData; -internal class DistinctChangeSet : ChangeSet, IDistinctChangeSet +internal sealed class DistinctChangeSet : ChangeSet, IDistinctChangeSet where T : notnull { public DistinctChangeSet(IEnumerable> items) diff --git a/src/DynamicData/Cache/Internal/AutoRefresh.cs b/src/DynamicData/Cache/Internal/AutoRefresh.cs index 51651ff1e..ecc6e0b72 100644 --- a/src/DynamicData/Cache/Internal/AutoRefresh.cs +++ b/src/DynamicData/Cache/Internal/AutoRefresh.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class AutoRefresh(IObservable> source, Func> reEvaluator, TimeSpan? buffer = null, IScheduler? scheduler = null) +internal sealed class AutoRefresh(IObservable> source, Func> reEvaluator, TimeSpan? buffer = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/Cache.cs b/src/DynamicData/Cache/Internal/Cache.cs index 7a6a62d9b..f4800ad74 100644 --- a/src/DynamicData/Cache/Internal/Cache.cs +++ b/src/DynamicData/Cache/Internal/Cache.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; [DebuggerDisplay("Cache<{typeof(TObject).Name}, {typeof(TKey).Name}> ({Count} Items)")] -internal class Cache : ICache +internal sealed class Cache : ICache where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/CacheUpdater.cs b/src/DynamicData/Cache/Internal/CacheUpdater.cs index 477cafd50..9f4ab8a84 100644 --- a/src/DynamicData/Cache/Internal/CacheUpdater.cs +++ b/src/DynamicData/Cache/Internal/CacheUpdater.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class CacheUpdater : ISourceUpdater +internal sealed class CacheUpdater : ISourceUpdater where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/Cast.cs b/src/DynamicData/Cache/Internal/Cast.cs index 36f64bd19..296d43562 100644 --- a/src/DynamicData/Cache/Internal/Cast.cs +++ b/src/DynamicData/Cache/Internal/Cast.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class Cast(IObservable> source, Func converter) +internal sealed class Cast(IObservable> source, Func converter) where TSource : notnull where TKey : notnull where TDestination : notnull diff --git a/src/DynamicData/Cache/Internal/ChangeSetCache.cs b/src/DynamicData/Cache/Internal/ChangeSetCache.cs index 4945883eb..d98c0a824 100644 --- a/src/DynamicData/Cache/Internal/ChangeSetCache.cs +++ b/src/DynamicData/Cache/Internal/ChangeSetCache.cs @@ -11,7 +11,7 @@ namespace DynamicData.Cache.Internal; /// /// ChangeSet Object Type. /// ChangeSet Key Type. -internal class ChangeSetCache +internal sealed class ChangeSetCache where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/ChangeSetMergeTracker.cs b/src/DynamicData/Cache/Internal/ChangeSetMergeTracker.cs index 55464e8e4..ecd2bba98 100644 --- a/src/DynamicData/Cache/Internal/ChangeSetMergeTracker.cs +++ b/src/DynamicData/Cache/Internal/ChangeSetMergeTracker.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class ChangeSetMergeTracker(Func>> selectCaches, IComparer? comparer, IEqualityComparer? equalityComparer) +internal sealed class ChangeSetMergeTracker(Func>> selectCaches, IComparer? comparer, IEqualityComparer? equalityComparer) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/DeferUntilLoaded.cs b/src/DynamicData/Cache/Internal/DeferUntilLoaded.cs index b28059cd7..e04e2608b 100644 --- a/src/DynamicData/Cache/Internal/DeferUntilLoaded.cs +++ b/src/DynamicData/Cache/Internal/DeferUntilLoaded.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class DeferUntilLoaded +internal sealed class DeferUntilLoaded where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/DynamicFilter.cs b/src/DynamicData/Cache/Internal/DynamicFilter.cs index c75cb7401..2faff65ca 100644 --- a/src/DynamicData/Cache/Internal/DynamicFilter.cs +++ b/src/DynamicData/Cache/Internal/DynamicFilter.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class DynamicFilter(IObservable> source, IObservable> predicateChanged, IObservable? refilterObservable = null, bool suppressEmptyChangeSets = true) +internal sealed class DynamicFilter(IObservable> source, IObservable> predicateChanged, IObservable? refilterObservable = null, bool suppressEmptyChangeSets = true) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/EditDiff.cs b/src/DynamicData/Cache/Internal/EditDiff.cs index 83ec01b51..ad7271c42 100644 --- a/src/DynamicData/Cache/Internal/EditDiff.cs +++ b/src/DynamicData/Cache/Internal/EditDiff.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class EditDiff(ISourceCache source, Func areEqual) +internal sealed class EditDiff(ISourceCache source, Func areEqual) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/FilterOnObservable.cs b/src/DynamicData/Cache/Internal/FilterOnObservable.cs index 25d334628..9c07397a7 100644 --- a/src/DynamicData/Cache/Internal/FilterOnObservable.cs +++ b/src/DynamicData/Cache/Internal/FilterOnObservable.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class FilterOnObservable(IObservable> source, Func> filterFactory, TimeSpan? buffer = null, IScheduler? scheduler = null) +internal sealed class FilterOnObservable(IObservable> source, Func> filterFactory, TimeSpan? buffer = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/FilterOnProperty.cs b/src/DynamicData/Cache/Internal/FilterOnProperty.cs index 303cfe8d7..7bb9e7653 100644 --- a/src/DynamicData/Cache/Internal/FilterOnProperty.cs +++ b/src/DynamicData/Cache/Internal/FilterOnProperty.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; [Obsolete("Use AutoRefresh(), followed by Filter() instead")] -internal class FilterOnProperty(IObservable> source, Expression> propertySelector, Func predicate, TimeSpan? throttle = null, IScheduler? scheduler = null) +internal sealed class FilterOnProperty(IObservable> source, Expression> propertySelector, Func predicate, TimeSpan? throttle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/FinallySafe.cs b/src/DynamicData/Cache/Internal/FinallySafe.cs index fb98e1d3c..bb19e6cdf 100644 --- a/src/DynamicData/Cache/Internal/FinallySafe.cs +++ b/src/DynamicData/Cache/Internal/FinallySafe.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class FinallySafe(IObservable source, Action finallyAction) +internal sealed class FinallySafe(IObservable source, Action finallyAction) { private readonly Action _finallyAction = finallyAction ?? throw new ArgumentNullException(nameof(finallyAction)); diff --git a/src/DynamicData/Cache/Internal/FullJoin.cs b/src/DynamicData/Cache/Internal/FullJoin.cs index f2d91f91b..ad75bd62b 100644 --- a/src/DynamicData/Cache/Internal/FullJoin.cs +++ b/src/DynamicData/Cache/Internal/FullJoin.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; -internal class FullJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func, Optional, TDestination> resultSelector) +internal sealed class FullJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func, Optional, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/FullJoinMany.cs b/src/DynamicData/Cache/Internal/FullJoinMany.cs index 005f09bc5..77530f4bf 100644 --- a/src/DynamicData/Cache/Internal/FullJoinMany.cs +++ b/src/DynamicData/Cache/Internal/FullJoinMany.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class FullJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, IGrouping, TDestination> resultSelector) +internal sealed class FullJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, IGrouping, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/GroupOnProperty.cs b/src/DynamicData/Cache/Internal/GroupOnProperty.cs index 094ef7df0..a7353c36c 100644 --- a/src/DynamicData/Cache/Internal/GroupOnProperty.cs +++ b/src/DynamicData/Cache/Internal/GroupOnProperty.cs @@ -11,7 +11,7 @@ namespace DynamicData.Cache.Internal; -internal class GroupOnProperty(IObservable> source, Expression> groupSelectorKey, TimeSpan? throttle = null, IScheduler? scheduler = null) +internal sealed class GroupOnProperty(IObservable> source, Expression> groupSelectorKey, TimeSpan? throttle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged where TKey : notnull where TGroup : notnull diff --git a/src/DynamicData/Cache/Internal/GroupOnPropertyWithImmutableState.cs b/src/DynamicData/Cache/Internal/GroupOnPropertyWithImmutableState.cs index 515e1d012..7914ebd65 100644 --- a/src/DynamicData/Cache/Internal/GroupOnPropertyWithImmutableState.cs +++ b/src/DynamicData/Cache/Internal/GroupOnPropertyWithImmutableState.cs @@ -11,7 +11,7 @@ namespace DynamicData.Cache.Internal; -internal class GroupOnPropertyWithImmutableState(IObservable> source, Expression> groupSelectorKey, TimeSpan? throttle = null, IScheduler? scheduler = null) +internal sealed class GroupOnPropertyWithImmutableState(IObservable> source, Expression> groupSelectorKey, TimeSpan? throttle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged where TKey : notnull where TGroup : notnull diff --git a/src/DynamicData/Cache/Internal/IndexAndNode.cs b/src/DynamicData/Cache/Internal/IndexAndNode.cs index 2546b6ece..ca24d3ff3 100644 --- a/src/DynamicData/Cache/Internal/IndexAndNode.cs +++ b/src/DynamicData/Cache/Internal/IndexAndNode.cs @@ -12,7 +12,7 @@ internal static class IndexAndNode } [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Same class name, different generics.")] -internal class IndexAndNode(int index, LinkedListNode node) +internal sealed class IndexAndNode(int index, LinkedListNode node) { public int Index { get; } = index; diff --git a/src/DynamicData/Cache/Internal/InnerJoin.cs b/src/DynamicData/Cache/Internal/InnerJoin.cs index 6332aa9c7..c71565ce5 100644 --- a/src/DynamicData/Cache/Internal/InnerJoin.cs +++ b/src/DynamicData/Cache/Internal/InnerJoin.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class InnerJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func<(TLeftKey leftKey, TRightKey rightKey), TLeft, TRight, TDestination> resultSelector) +internal sealed class InnerJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func<(TLeftKey leftKey, TRightKey rightKey), TLeft, TRight, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/InnerJoinMany.cs b/src/DynamicData/Cache/Internal/InnerJoinMany.cs index 9601a21dd..578e071b8 100644 --- a/src/DynamicData/Cache/Internal/InnerJoinMany.cs +++ b/src/DynamicData/Cache/Internal/InnerJoinMany.cs @@ -4,7 +4,7 @@ namespace DynamicData.Cache.Internal; -internal class InnerJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, TDestination> resultSelector) +internal sealed class InnerJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/KeyValueCollection.cs b/src/DynamicData/Cache/Internal/KeyValueCollection.cs index 5b2d3c641..414e00367 100644 --- a/src/DynamicData/Cache/Internal/KeyValueCollection.cs +++ b/src/DynamicData/Cache/Internal/KeyValueCollection.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class KeyValueCollection : IKeyValueCollection +internal sealed class KeyValueCollection : IKeyValueCollection { private readonly IReadOnlyCollection> _items; diff --git a/src/DynamicData/Cache/Internal/KeyValueComparer.cs b/src/DynamicData/Cache/Internal/KeyValueComparer.cs index fd629e895..c2a4bdcdc 100644 --- a/src/DynamicData/Cache/Internal/KeyValueComparer.cs +++ b/src/DynamicData/Cache/Internal/KeyValueComparer.cs @@ -4,7 +4,7 @@ namespace DynamicData.Cache.Internal; -internal class KeyValueComparer(IComparer? comparer = null) : IComparer> +internal sealed class KeyValueComparer(IComparer? comparer = null) : IComparer> { public int Compare(KeyValuePair x, KeyValuePair y) { diff --git a/src/DynamicData/Cache/Internal/LeftJoin.cs b/src/DynamicData/Cache/Internal/LeftJoin.cs index ef69cb835..c5a7992d0 100644 --- a/src/DynamicData/Cache/Internal/LeftJoin.cs +++ b/src/DynamicData/Cache/Internal/LeftJoin.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; -internal class LeftJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func, TDestination> resultSelector) +internal sealed class LeftJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/LeftJoinMany.cs b/src/DynamicData/Cache/Internal/LeftJoinMany.cs index fa5921410..dfd1a72c1 100644 --- a/src/DynamicData/Cache/Internal/LeftJoinMany.cs +++ b/src/DynamicData/Cache/Internal/LeftJoinMany.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class LeftJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, TDestination> resultSelector) +internal sealed class LeftJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/MergeMany.cs b/src/DynamicData/Cache/Internal/MergeMany.cs index 4fcca76a6..53164855c 100644 --- a/src/DynamicData/Cache/Internal/MergeMany.cs +++ b/src/DynamicData/Cache/Internal/MergeMany.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class MergeMany +internal sealed class MergeMany where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/MergeManyItems.cs b/src/DynamicData/Cache/Internal/MergeManyItems.cs index cbb484355..3282469b7 100644 --- a/src/DynamicData/Cache/Internal/MergeManyItems.cs +++ b/src/DynamicData/Cache/Internal/MergeManyItems.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class MergeManyItems +internal sealed class MergeManyItems where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/Page.cs b/src/DynamicData/Cache/Internal/Page.cs index ed07863d3..a80e597eb 100644 --- a/src/DynamicData/Cache/Internal/Page.cs +++ b/src/DynamicData/Cache/Internal/Page.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class Page(IObservable> source, IObservable pageRequests) +internal sealed class Page(IObservable> source, IObservable pageRequests) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/QueryWhenChanged.cs b/src/DynamicData/Cache/Internal/QueryWhenChanged.cs index c401d1d9d..321bd3ded 100644 --- a/src/DynamicData/Cache/Internal/QueryWhenChanged.cs +++ b/src/DynamicData/Cache/Internal/QueryWhenChanged.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class QueryWhenChanged(IObservable> source, Func>? itemChangedTrigger = null) +internal sealed class QueryWhenChanged(IObservable> source, Func>? itemChangedTrigger = null) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/RefCount.cs b/src/DynamicData/Cache/Internal/RefCount.cs index 875916095..d9e1fe500 100644 --- a/src/DynamicData/Cache/Internal/RefCount.cs +++ b/src/DynamicData/Cache/Internal/RefCount.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class RefCount(IObservable> source) +internal sealed class RefCount(IObservable> source) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/RemoveKeyEnumerator.cs b/src/DynamicData/Cache/Internal/RemoveKeyEnumerator.cs index aa29cd4b6..2a7b02e74 100644 --- a/src/DynamicData/Cache/Internal/RemoveKeyEnumerator.cs +++ b/src/DynamicData/Cache/Internal/RemoveKeyEnumerator.cs @@ -12,7 +12,7 @@ namespace DynamicData.Cache.Internal; /// An optional list, if provided it allows the refresh from a key based cache to find the index for the resulting list based refresh. /// If not provided a refresh will dropdown to a replace which may ultimately result in a remove+add change downstream. /// -internal class RemoveKeyEnumerator(IChangeSet source, IExtendedList? list = null) : IEnumerable> +internal sealed class RemoveKeyEnumerator(IChangeSet source, IExtendedList? list = null) : IEnumerable> where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/RightJoin.cs b/src/DynamicData/Cache/Internal/RightJoin.cs index a08552fd8..ca733db25 100644 --- a/src/DynamicData/Cache/Internal/RightJoin.cs +++ b/src/DynamicData/Cache/Internal/RightJoin.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; -internal class RightJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func, TRight, TDestination> resultSelector) +internal sealed class RightJoin(IObservable> left, IObservable> right, Func rightKeySelector, Func, TRight, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/RightJoinMany.cs b/src/DynamicData/Cache/Internal/RightJoinMany.cs index cbb7ef519..44879eff5 100644 --- a/src/DynamicData/Cache/Internal/RightJoinMany.cs +++ b/src/DynamicData/Cache/Internal/RightJoinMany.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class RightJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, IGrouping, TDestination> resultSelector) +internal sealed class RightJoinMany(IObservable> left, IObservable> right, Func rightKeySelector, Func, IGrouping, TDestination> resultSelector) where TLeft : notnull where TLeftKey : notnull where TRight : notnull diff --git a/src/DynamicData/Cache/Internal/SizeExpirer.cs b/src/DynamicData/Cache/Internal/SizeExpirer.cs index d719453b2..3e4155c58 100644 --- a/src/DynamicData/Cache/Internal/SizeExpirer.cs +++ b/src/DynamicData/Cache/Internal/SizeExpirer.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; -internal class SizeExpirer +internal sealed class SizeExpirer where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/SpecifiedGrouper.cs b/src/DynamicData/Cache/Internal/SpecifiedGrouper.cs index ba6bd9753..292e0112d 100644 --- a/src/DynamicData/Cache/Internal/SpecifiedGrouper.cs +++ b/src/DynamicData/Cache/Internal/SpecifiedGrouper.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class SpecifiedGrouper(IObservable> source, Func groupSelector, IObservable> resultGroupSource) +internal sealed class SpecifiedGrouper(IObservable> source, Func groupSelector, IObservable> resultGroupSource) where TObject : notnull where TKey : notnull where TGroupKey : notnull diff --git a/src/DynamicData/Cache/Internal/StaticFilter.cs b/src/DynamicData/Cache/Internal/StaticFilter.cs index 35c451ee0..d6fc7cbe5 100644 --- a/src/DynamicData/Cache/Internal/StaticFilter.cs +++ b/src/DynamicData/Cache/Internal/StaticFilter.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class StaticFilter(IObservable> source, Func filter, bool suppressEmptyChangeSets) +internal sealed class StaticFilter(IObservable> source, Func filter, bool suppressEmptyChangeSets) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/StatusMonitor.cs b/src/DynamicData/Cache/Internal/StatusMonitor.cs index ff9bb23e7..8aad491f1 100644 --- a/src/DynamicData/Cache/Internal/StatusMonitor.cs +++ b/src/DynamicData/Cache/Internal/StatusMonitor.cs @@ -10,7 +10,7 @@ namespace DynamicData.Cache.Internal; -internal class StatusMonitor(IObservable source) +internal sealed class StatusMonitor(IObservable source) { public IObservable Run() => Observable.Create( observer => diff --git a/src/DynamicData/Cache/Internal/SubscribeMany.cs b/src/DynamicData/Cache/Internal/SubscribeMany.cs index a61a68610..bf6eb1d9f 100644 --- a/src/DynamicData/Cache/Internal/SubscribeMany.cs +++ b/src/DynamicData/Cache/Internal/SubscribeMany.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class SubscribeMany +internal sealed class SubscribeMany where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/TimeExpirer.cs b/src/DynamicData/Cache/Internal/TimeExpirer.cs index 991638434..ad48c800b 100644 --- a/src/DynamicData/Cache/Internal/TimeExpirer.cs +++ b/src/DynamicData/Cache/Internal/TimeExpirer.cs @@ -10,7 +10,7 @@ namespace DynamicData.Cache.Internal; -internal class TimeExpirer(IObservable> source, Func timeSelector, TimeSpan? interval, IScheduler scheduler) +internal sealed class TimeExpirer(IObservable> source, Func timeSelector, TimeSpan? interval, IScheduler scheduler) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/ToObservableChangeSet.cs b/src/DynamicData/Cache/Internal/ToObservableChangeSet.cs index 842331bcb..7b1656074 100644 --- a/src/DynamicData/Cache/Internal/ToObservableChangeSet.cs +++ b/src/DynamicData/Cache/Internal/ToObservableChangeSet.cs @@ -9,7 +9,7 @@ namespace DynamicData.Cache.Internal; -internal class ToObservableChangeSet +internal sealed class ToObservableChangeSet where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/ToObservableOptional.cs b/src/DynamicData/Cache/Internal/ToObservableOptional.cs index e849a5158..15e8f8684 100644 --- a/src/DynamicData/Cache/Internal/ToObservableOptional.cs +++ b/src/DynamicData/Cache/Internal/ToObservableOptional.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class ToObservableOptional(IObservable> source, TKey key, IEqualityComparer? equalityComparer = null) +internal sealed class ToObservableOptional(IObservable> source, TKey key, IEqualityComparer? equalityComparer = null) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/TransformAsync.cs b/src/DynamicData/Cache/Internal/TransformAsync.cs index 6f0d69c2b..2b0b5788a 100644 --- a/src/DynamicData/Cache/Internal/TransformAsync.cs +++ b/src/DynamicData/Cache/Internal/TransformAsync.cs @@ -8,7 +8,7 @@ namespace DynamicData.Cache.Internal; -internal class TransformAsync(IObservable> source, Func, TKey, Task> transformFactory, Action>? exceptionCallback, IObservable>? forceTransform = null) +internal sealed class TransformAsync(IObservable> source, Func, TKey, Task> transformFactory, Action>? exceptionCallback, IObservable>? forceTransform = null) where TDestination : notnull where TSource : notnull where TKey : notnull diff --git a/src/DynamicData/Cache/Internal/TransformMany.cs b/src/DynamicData/Cache/Internal/TransformMany.cs index bd5d8efb8..f8fe8d2b3 100644 --- a/src/DynamicData/Cache/Internal/TransformMany.cs +++ b/src/DynamicData/Cache/Internal/TransformMany.cs @@ -12,7 +12,7 @@ namespace DynamicData.Cache.Internal; -internal class TransformMany(IObservable> source, Func> manySelector, Func keySelector, Func>>? childChanges = null) +internal sealed class TransformMany(IObservable> source, Func> manySelector, Func keySelector, Func>>? childChanges = null) where TDestination : notnull where TDestinationKey : notnull where TSource : notnull diff --git a/src/DynamicData/Cache/Internal/TreeBuilder.cs b/src/DynamicData/Cache/Internal/TreeBuilder.cs index 72f903e41..6f679b9f4 100644 --- a/src/DynamicData/Cache/Internal/TreeBuilder.cs +++ b/src/DynamicData/Cache/Internal/TreeBuilder.cs @@ -11,7 +11,7 @@ namespace DynamicData.Cache.Internal; -internal class TreeBuilder(IObservable> source, Func pivotOn, IObservable, bool>>? predicateChanged) +internal sealed class TreeBuilder(IObservable> source, Func pivotOn, IObservable, bool>>? predicateChanged) where TObject : class where TKey : notnull { diff --git a/src/DynamicData/Cache/Internal/TrueFor.cs b/src/DynamicData/Cache/Internal/TrueFor.cs index 5c7c7b54a..333cc69d1 100644 --- a/src/DynamicData/Cache/Internal/TrueFor.cs +++ b/src/DynamicData/Cache/Internal/TrueFor.cs @@ -7,7 +7,7 @@ namespace DynamicData.Cache.Internal; -internal class TrueFor(IObservable> source, Func> observableSelector, Func>, bool> collectionMatcher) +internal sealed class TrueFor(IObservable> source, Func> observableSelector, Func>, bool> collectionMatcher) where TObject : notnull where TKey : notnull where TValue : notnull diff --git a/src/DynamicData/Cache/Internal/UniquenessEnforcer.cs b/src/DynamicData/Cache/Internal/UniquenessEnforcer.cs index e86c2d1a1..53bf65ac5 100644 --- a/src/DynamicData/Cache/Internal/UniquenessEnforcer.cs +++ b/src/DynamicData/Cache/Internal/UniquenessEnforcer.cs @@ -6,7 +6,7 @@ namespace DynamicData.Cache.Internal; -internal class UniquenessEnforcer(IObservable> source) +internal sealed class UniquenessEnforcer(IObservable> source) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Cache/SortedChangeSet.cs b/src/DynamicData/Cache/SortedChangeSet.cs index e39079e77..0a1bf615e 100644 --- a/src/DynamicData/Cache/SortedChangeSet.cs +++ b/src/DynamicData/Cache/SortedChangeSet.cs @@ -7,7 +7,7 @@ // ReSharper disable once CheckNamespace namespace DynamicData; -internal class SortedChangeSet : ChangeSet, ISortedChangeSet +internal sealed class SortedChangeSet : ChangeSet, ISortedChangeSet where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Experimental/SubjectWithRefCount.cs b/src/DynamicData/Experimental/SubjectWithRefCount.cs index 38903dc33..55d359080 100644 --- a/src/DynamicData/Experimental/SubjectWithRefCount.cs +++ b/src/DynamicData/Experimental/SubjectWithRefCount.cs @@ -15,7 +15,7 @@ namespace DynamicData.Experimental; /// Initializes a new instance of the class. /// /// The subject to perform reference counting on. -internal class SubjectWithRefCount(ISubject? subject = null) : ISubjectWithRefCount +internal sealed class SubjectWithRefCount(ISubject? subject = null) : ISubjectWithRefCount { private readonly ISubject _subject = subject ?? new Subject(); diff --git a/src/DynamicData/Kernel/ReferenceEqualityComparer.cs b/src/DynamicData/Kernel/ReferenceEqualityComparer.cs index 2af0b2e6c..e1e6ae703 100644 --- a/src/DynamicData/Kernel/ReferenceEqualityComparer.cs +++ b/src/DynamicData/Kernel/ReferenceEqualityComparer.cs @@ -4,7 +4,7 @@ namespace DynamicData.Kernel; -internal class ReferenceEqualityComparer : IEqualityComparer +internal sealed class ReferenceEqualityComparer : IEqualityComparer { public static readonly IEqualityComparer Instance = new ReferenceEqualityComparer(); diff --git a/src/DynamicData/List/ChangeAwareListWithRefCounts.cs b/src/DynamicData/List/ChangeAwareListWithRefCounts.cs index eaf237894..2467bc952 100644 --- a/src/DynamicData/List/ChangeAwareListWithRefCounts.cs +++ b/src/DynamicData/List/ChangeAwareListWithRefCounts.cs @@ -8,7 +8,7 @@ // ReSharper disable once CheckNamespace namespace DynamicData; -internal class ChangeAwareListWithRefCounts : ChangeAwareList +internal sealed class ChangeAwareListWithRefCounts : ChangeAwareList where T : notnull { private readonly ReferenceCountTracker _tracker = new(); diff --git a/src/DynamicData/List/Linq/AddKeyEnumerator.cs b/src/DynamicData/List/Linq/AddKeyEnumerator.cs index d51883eba..ef288a1c7 100644 --- a/src/DynamicData/List/Linq/AddKeyEnumerator.cs +++ b/src/DynamicData/List/Linq/AddKeyEnumerator.cs @@ -6,7 +6,7 @@ namespace DynamicData.List.Linq; -internal class AddKeyEnumerator(IChangeSet source, Func keySelector) : IEnumerable> +internal sealed class AddKeyEnumerator(IChangeSet source, Func keySelector) : IEnumerable> where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/List/Linq/ItemChangeEnumerator.cs b/src/DynamicData/List/Linq/ItemChangeEnumerator.cs index f575c24bc..9736149dc 100644 --- a/src/DynamicData/List/Linq/ItemChangeEnumerator.cs +++ b/src/DynamicData/List/Linq/ItemChangeEnumerator.cs @@ -6,7 +6,7 @@ namespace DynamicData.List.Linq; -internal class ItemChangeEnumerator(IChangeSet changeSet) : IEnumerable> +internal sealed class ItemChangeEnumerator(IChangeSet changeSet) : IEnumerable> where T : notnull { public IEnumerator> GetEnumerator() diff --git a/src/DynamicData/List/Linq/Reverser.cs b/src/DynamicData/List/Linq/Reverser.cs index 9e91ba5a5..67cf918d1 100644 --- a/src/DynamicData/List/Linq/Reverser.cs +++ b/src/DynamicData/List/Linq/Reverser.cs @@ -4,7 +4,7 @@ namespace DynamicData.List.Linq; -internal class Reverser +internal sealed class Reverser where T : notnull { private int _length; diff --git a/src/DynamicData/List/Linq/UnifiedChangeEnumerator.cs b/src/DynamicData/List/Linq/UnifiedChangeEnumerator.cs index 3f511f484..2c81f8da2 100644 --- a/src/DynamicData/List/Linq/UnifiedChangeEnumerator.cs +++ b/src/DynamicData/List/Linq/UnifiedChangeEnumerator.cs @@ -8,7 +8,7 @@ namespace DynamicData.List.Linq; -internal class UnifiedChangeEnumerator(IChangeSet changeSet) : IEnumerable> +internal sealed class UnifiedChangeEnumerator(IChangeSet changeSet) : IEnumerable> where T : notnull { public IEnumerator> GetEnumerator() diff --git a/src/DynamicData/List/Linq/WithoutIndexEnumerator.cs b/src/DynamicData/List/Linq/WithoutIndexEnumerator.cs index 31d7505e0..47f02f031 100644 --- a/src/DynamicData/List/Linq/WithoutIndexEnumerator.cs +++ b/src/DynamicData/List/Linq/WithoutIndexEnumerator.cs @@ -11,7 +11,7 @@ namespace DynamicData.List.Linq; /// Otherwise these operators could break subsequent operators when the subsequent operator relies on the index. /// /// The type of the item. -internal class WithoutIndexEnumerator(IEnumerable> changeSet) : IEnumerable> +internal sealed class WithoutIndexEnumerator(IEnumerable> changeSet) : IEnumerable> where T : notnull { public IEnumerator> GetEnumerator() diff --git a/src/DynamicData/List/VirtualChangeSet.cs b/src/DynamicData/List/VirtualChangeSet.cs index f5b733895..bf62b059e 100644 --- a/src/DynamicData/List/VirtualChangeSet.cs +++ b/src/DynamicData/List/VirtualChangeSet.cs @@ -7,7 +7,7 @@ // ReSharper disable once CheckNamespace namespace DynamicData; -internal class VirtualChangeSet(IChangeSet virtualChangeSet, IVirtualResponse response) : IVirtualChangeSet +internal sealed class VirtualChangeSet(IChangeSet virtualChangeSet, IVirtualResponse response) : IVirtualChangeSet where T : notnull { private readonly IChangeSet _virtualChangeSet = virtualChangeSet ?? throw new ArgumentNullException(nameof(virtualChangeSet)); diff --git a/src/DynamicData/Platforms/net45/PFilter.cs b/src/DynamicData/Platforms/net45/PFilter.cs index 8a04b791d..97887fe88 100644 --- a/src/DynamicData/Platforms/net45/PFilter.cs +++ b/src/DynamicData/Platforms/net45/PFilter.cs @@ -11,7 +11,7 @@ // ReSharper disable once CheckNamespace namespace DynamicData.PLinq { - internal class PFilter(IObservable> source, Func filter, ParallelisationOptions parallelisationOptions) + internal sealed class PFilter(IObservable> source, Func filter, ParallelisationOptions parallelisationOptions) where TObject : notnull where TKey : notnull { diff --git a/src/DynamicData/Platforms/net45/PSubscribeMany.cs b/src/DynamicData/Platforms/net45/PSubscribeMany.cs index 294cdce15..1ab71c2c8 100644 --- a/src/DynamicData/Platforms/net45/PSubscribeMany.cs +++ b/src/DynamicData/Platforms/net45/PSubscribeMany.cs @@ -9,7 +9,7 @@ // ReSharper disable once CheckNamespace namespace DynamicData.PLinq { - internal class PSubscribeMany(IObservable> source, Func subscriptionFactory, ParallelisationOptions parallelisationOptions) + internal sealed class PSubscribeMany(IObservable> source, Func subscriptionFactory, ParallelisationOptions parallelisationOptions) where TObject : notnull where TKey : notnull {