Skip to content

Commit

Permalink
Refactored code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mahara committed Dec 25, 2023
1 parent 7ff44ac commit 944cb3e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NHibernate" Version="5.5.0" />
<PackageVersion Include="NHibernate" Version="[5.4,6.0)" />
<PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit.Analyzers" Version="3.10.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<ItemGroup>
<PackageReference Include="System.Data.SqlClient" />
<PackageReference Include="Iesi.Collections" />
<PackageReference Include="NHibernate" />
<PackageReference Include="Remotion.Linq" />
<PackageReference Include="Remotion.Linq.EagerFetching" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void UpdateOneSide<T>(T thisManySide, object oldOneSide, object ne
/// <summary>
/// Responds to add/remove events raised by the one-side's collection.
/// </summary>
public void UpdateManySide(object sender, NotifyCollectionChangedEventArgs e)
public void UpdateManySide(object? sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Iesi.Collections" />
<PackageReference Include="LiquidTestReports.Markdown" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NHibernate" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit.Analyzers">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Iesi.Collections.Generic.Tests
[TestFixture]
public class ObservableCollectionTests
{
private readonly List<int> _items = new();
private readonly List<int> _items = [];

[OneTimeSetUp]
public void SetupFixture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Iesi.Collections.Generic.Tests
[TestFixture]
public class ObservableSetTests
{
private readonly List<int> _items = new();
private readonly List<int> _items = [];

[OneTimeSetUp]
public void SetupFixture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ protected virtual void RemoveItemsRange(IEnumerable<T> collection)
}
else
{
clusters[lastIndex = index] = lastCluster = new List<T> { item };
clusters[lastIndex = index] = lastCluster = [item];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.ObservableCollections/ObservableSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ private void OnCountPropertyChanged()

internal static class EventArgsCache
{
public static readonly List<T> NoItems = new();
public static readonly List<T> NoItems = [];

public static readonly PropertyChangingEventArgs CountPropertyChanging = new(nameof(ObservableSet<T>.Count));
public static readonly PropertyChangedEventArgs CountPropertyChanged = new(nameof(ObservableSet<T>.Count));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ public ReadOnlyObservableCollection(ObservableCollection<T> collection) :
((INotifyPropertyChanged) Items).PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);
}

#if !NET8_0_OR_GREATER
/// <summary>
/// Gets an empty <see cref="ReadOnlyObservableCollection{T}" />.
/// </summary>
/// <value>An empty <see cref="ReadOnlyObservableCollection{T}" />.</value>
/// <remarks>The returned instance is immutable and will always be empty.</remarks>
public static ReadOnlyObservableCollection<T> Empty { get; } =
new ReadOnlyObservableCollection<T>(new ObservableCollection<T>());
new ReadOnlyObservableCollection<T>([]);
#endif

/// <summary>
/// CollectionChanged event (per <see cref="INotifyCollectionChanged" />).
Expand Down

0 comments on commit 944cb3e

Please sign in to comment.