Skip to content

Commit a1e1be7

Browse files
committed
Add AlternateLookups and WinRT compatibility, bump versions
1 parent 6d7b441 commit a1e1be7

32 files changed

Lines changed: 1221 additions & 85 deletions

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ dotnet_diagnostic.SA1200.severity = none
281281
# SA1618: Generic type parameters should be documented
282282
dotnet_diagnostic.SA1618.severity = suggestion
283283

284+
# SA1619: Generic type parameters should be documented partial class
285+
dotnet_diagnostic.SA1619.severity = suggestion
286+
284287
# CA1303: Do not pass literals as localized parameters
285288
dotnet_diagnostic.CA1303.severity = none
286289

@@ -396,4 +399,4 @@ dotnet_diagnostic.IDE0057.severity = warning
396399
dotnet_diagnostic.IDE0059.severity = warning
397400

398401
# RS0030: Do not use banned APIs
399-
dotnet_diagnostic.RS0030.severity = error
402+
dotnet_diagnostic.RS0030.severity = error

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
with:
1919
dotnet-version: |
2020
6.0.x
21-
7.0.x
2221
8.0.x
22+
9.0.x
2323
- name: Clean
2424
run: dotnet clean --configuration Debug && dotnet nuget locals all --clear
2525
- name: Install dependencies
@@ -40,8 +40,8 @@ jobs:
4040
with:
4141
dotnet-version: |
4242
6.0.x
43-
7.0.x
4443
8.0.x
44+
9.0.x
4545
- name: Clean
4646
run: dotnet clean --configuration Release && dotnet nuget locals all --clear
4747
- name: Install dependencies

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Singulink.Collections
44

5+
### V3.2
6+
- `AlternateLookup` support for keyed collections
7+
- WinRT compatibility
8+
59
### V3.1
610
- Full support for AOT and trimming
711

@@ -17,6 +21,10 @@
1721

1822
## Singulink.Collections.Weak
1923

24+
### V2.2
25+
- `AlternateLookup` support for `WeakDictionary`
26+
- WinRT compatibility
27+
2028
### V2.1
2129
- Full support for AOT and trimming
2230

Directory.Build.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<Project>
22
<PropertyGroup>
3-
<LangVersion>12.0</LangVersion>
3+
<LangVersion>preview</LangVersion>
44
<Nullable Condition="'$(TargetFramework)' != 'netstandard2.0'">enable</Nullable>
55
<Nullable Condition="'$(TargetFramework)' == 'netstandard2.0'">annotations</Nullable>
66
<NoWarn>CS8769</NoWarn>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
910

1011
<WeaverConfiguration>
1112
<Weavers>
@@ -20,11 +21,11 @@
2021

2122
<ItemGroup>
2223
<!-- Fody -->
23-
<PackageReference Include="RuntimeNullables.Fody" Version="1.0.6" PrivateAssets="all" />
24+
<PackageReference Include="RuntimeNullables.Fody" Version="2.0.0" PrivateAssets="all" />
2425

2526
<!-- Analyzers -->
2627
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" PrivateAssets="all" />
2728
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
28-
<PackageReference Include="Roslynator.Analyzers" Version="4.11.0" PrivateAssets="all" />
29+
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4" PrivateAssets="all" />
2930
</ItemGroup>
3031
</Project>

Docs/docfx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"metadata": [
33
{
44
"properties": {
5-
"TargetFramework": "net6.0"
5+
"TargetFramework": "net9.0"
66
},
77
"src": [
88
{

Docs/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ The following collections are included in the package:
1010
- `HashSetDictionary`: Collection of keys mapped to a hash set of unique values per key.
1111
- `ListDictionary`: Collection of keys mapped to a list of values per key.
1212
- `Map`: Collection of two types of values that map between each other in a bidirectional one-to-one relationship.
13-
- `ReadOnlyHashSet`: Fast read-only wrapper around a HashSet (instead of going through `ISet<>`).
14-
- `ReadOnlyList`: Fast read-only wrapper around a List (instead of going through `IList<>`).
13+
- `AlternateLookup` nested types for each of the above collections that allow looking up values by alternate keys.
14+
- `ReadOnlyHashSet`: Fast direct read-only wrapper for HashSets (instead of going through `ISet<>` like `ReadOnlySet` does).
15+
- `ReadOnlyList`: Fast direct read-only wrapper for Lists (instead of going through `IList<>` like `ReadOnlyCollection` does).
1516
- A full set of interfaces for the new collections as well as an `IReadOnlySet<>` polyfill for .NET Standard.
1617

1718
**Singulink.Collections.Weak** provides a set of collection classes that store weak references to values so that the garbage collector is free to reclaim the memory they use when they aren't being referenced anymore. The values returned by the collections will never be `null` - if the value was garbage collected then the collection behaves as if the value was removed from the collection.
1819

1920
The following collections are included in the package:
2021
- `WeakCollection`: Collection of weakly referenced values that keeps items in an undefined order.
2122
- `WeakList`: Collection of weakly referenced values that maintains relative insertion order.
22-
- `WeakValueDictionary`: Collection of keys and weakly referenced values.
23+
- `WeakValueDictionary`: Collection of keys and weakly referenced values with `AlternateLookup` support.
2324

2425
### About Singulink
2526

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ The following collections are included in the package:
1414
- `HashSetDictionary`: Collection of keys mapped to a hash set of unique values per key.
1515
- `ListDictionary`: Collection of keys mapped to a list of values per key.
1616
- `Map`: Collection of two types of values that map between each other in a bidirectional one-to-one relationship.
17-
- `ReadOnlyHashSet`: Fast read-only wrapper around a HashSet (instead of going through `ISet<>`).
18-
- `ReadOnlyList`: Fast read-only wrapper around a List (instead of going through `IList<>`).
19-
- A full set of interfaces and read-only wrappers for the new collections as well as an `IReadOnlySet<>` polyfill for .NET Standard.
17+
- `AlternateLookup` nested wrapper types for each of the above collections that allow looking up values by alternate keys.
18+
- `ReadOnlyHashSet`: Fast direct read-only wrapper for HashSets (instead of going through `ISet<>` like `ReadOnlySet` does).
19+
- `ReadOnlyList`: Fast direct read-only wrapper for Lists (instead of going through `IList<>` like `ReadOnlyCollection` does).
20+
- A full set of interfaces for the new collections as well as an `IReadOnlySet<>` polyfill for .NET Standard.
2021

2122
**Singulink.Collections.Weak** provides a set of collection classes that store weak references to values so that the garbage collector is free to reclaim the memory they use when they aren't being referenced anymore. The values returned by the collections will never be `null` - if the value was garbage collected then the collection behaves as if the value was removed from the collection.
2223

2324
The following collections are included in the package:
2425
- `WeakCollection`: Collection of weakly referenced values that keeps items in an undefined order.
2526
- `WeakList`: Collection of weakly referenced values that maintains relative insertion order.
26-
- `WeakValueDictionary`: Collection of keys and weakly referenced values.
27+
- `WeakValueDictionary`: Collection of keys and weakly referenced values with `AlternateLookup` support.
2728

2829
### About Singulink
2930

@@ -68,8 +69,6 @@ int one = nameToNumberMap["ONE"]; // 1
6869

6970
### ListDictionary
7071

71-
Very similar API to `HashSetDictionary`, and both can be exposed as `ICollectionDictionary`:
72-
7372
```c#
7473
var numberNames = new ListDictionary<int, string>();
7574
numberNames[1].AddRange("One", "Uno");
@@ -85,7 +84,7 @@ numberNames.ContainsKey(3); // false
8584
threeNamesList.Add("Three");
8685
numberNames.ContainsKey(3); // true
8786
88-
// Lists are automatically removed from the dictionary when they become empty
87+
// Lists are automatically removed from the dictionary when they are empty
8988
9089
threeNamesList.Clear();
9190
numberNames.TryGetValues(3, out threeNamesList); // false

Source/Directory.Build.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
1212
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1313

14-
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsAotCompatible>
14+
<AnalysisLevel>latest-Recommended</AnalysisLevel>
15+
</PropertyGroup>
16+
17+
<PropertyGroup Label="AOT Compatibility" Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
18+
<IsAotCompatible>true</IsAotCompatible>
19+
<CsWinRTAotWarningLevel>2</CsWinRTAotWarningLevel>
1520
</PropertyGroup>
1621

1722
<PropertyGroup Label="Source Link" Condition="'$(Configuration)' == 'Release'">
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Collection type naming recommendations not applicable")]

Source/Singulink.Collections.Weak/Singulink.Collections.Weak.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net6.0-windows10.0.19041;net8.0;net8.0-windows10.0.19041;net9.0;net9.0-windows10.0.19041;</TargetFrameworks>
44
<RootNamespace>Singulink.Collections</RootNamespace>
55

6-
<Version>2.1.0</Version>
6+
<Version>2.2.0</Version>
77
<PackageTags>weak, dictionary, value, collection, list</PackageTags>
88
<Description>Collection classes that store weak references to values so that they can be garbage collected when they are no longer needed.</Description>
99
<PackageProjectUrl>https://github.com/Singulink/Singulink.Collections.Weak</PackageProjectUrl>

0 commit comments

Comments
 (0)