Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikernet committed Mar 9, 2024
1 parent 9fefdf6 commit d7e99c9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Docs/api/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Singulink.Collections.Weak
# Singulink.Collections

Use the table of contents to browse API documentation for the **Singulink.Collections.Weak** library.
Use the table of contents to browse API documentation for the **Singulink.Collections** and **Singulink.Collections.Weak** libraries.
29 changes: 16 additions & 13 deletions Docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

**Singulink.Collections** provides generally useful collections that are missing from .NET. They are highly optimized for performance, well documented and follow the same design principles as built-in .NET collections so they should feel instantly familiar.

The following collections are included in the `Singulink.Collections`:
The following collections are included in the package:
- `HashSetDictionary`: Collection of keys mapped to a hash set of unique values per key.
- `ListDictionary`: Collection of keys mapped to a list of values per key.
- `Map`: Collection of two types of values that map between each other in a bidirectional one-to-one relationship.
- `ReadOnlyHashSet`: Fast read-only wrapper around a HashSet (instead of going through `ISet<>`).
- `ReadOnlyList`: Fast read-only wrapper around a List (instead of going through `IList<>`).

**Singulink.Collections.Abstractions** provides a full set of interfaces for the new collections as well as an `IReadOnlySet` polyfill for .NET Standard.
- A full set of interfaces for the new collections as well as an `IReadOnlySet<>` polyfill for .NET Standard.

**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.

Expand All @@ -22,11 +21,15 @@ The following collections are included in the package:
- `WeakList`: Collection of weakly referenced values that maintains relative insertion order.
- `WeakValueDictionary`: Collection of keys and weakly referenced values.

**Singulink.Collections** is part of the **Singulink Libraries** collection. Visit https://github.com/Singulink/ to see the full list of libraries available.
### About Singulink

We are a small team of engineers and designers dedicated to building beautiful, functional and well-engineered software solutions. We offer very competitive rates as well as fixed-price contracts and welcome inquiries to discuss any custom development / project support needs you may have.

This package is part of our **Singulink Libraries** collection. Visit https://github.com/Singulink to see our full list of publicly available libraries and other open-source projects.

## Installation

The packages are available on NuGet - simply install the `Singulink.Collections`, `Singulink.Collections.Abstractions` and/or `Singulink.Collections.Weak` packages.
The packages are available on NuGet - simply install the `Singulink.Collections` and/or `Singulink.Collections.Weak` packages.

**Supported Runtimes**: Everywhere .NET Standard 2.0 is supported, including:
- .NET
Expand Down Expand Up @@ -90,31 +93,31 @@ public class YourClass
{
private ListDictionary<int, string> _numberNames;

// Expose as IListDictionary (with IList<string> values)
// Expose as Singulink IListDictionary (with .NET IList<string> values)
public IListDictionary<int, string> NumberNames => _numberNames;

// Expose as IReadOnlyListDictionary (with IReadOnlyList<string> values)
// Expose as Singulink IReadOnlyListDictionary (with .NET IReadOnlyList<string> values)
public IReadOnlyListDictionary<int, string> NumberNames => _numberNames.AsReadOnly();

// Expose as ICollectionDictionary (with ICollection<string> values)
// Expose as Singulink ICollectionDictionary (with .NET ICollection<string> values)
public ICollectionDictionary<int, string> NumberNames => _numberNames.AsCollectionDictionary();

// Expose as IReadOnlyCollectionDictionary (with IReadOnlyCollection<string> values)
// Expose as Singulink IReadOnlyCollectionDictionary (with .NET IReadOnlyCollection<string> values)
public IReadOnlyCollectionDictionary<int, string> NumberNames => _numberNames.AsReadOnlyCollectionDictionary();

// Expose as IReadOnlyDictionary<int, IList<string>>
// Expose as .NET IReadOnlyDictionary<int, IList<string>>
// Note that values can still be added/removed/modified through the value ILists even though it is
// an IReadOnlyDictionary. Many of the additional API's present in the IDictionary interface are
// not sensible in the context of a collection dictionary so that interface is not supported.
public IReadOnlyDictionary<int, IList<string>> NumberNames => _numberNames;

// Expose as IReadOnlyDictionary<int, IReadOnlyList<string>> (fully read-only)
// Expose as .NET IReadOnlyDictionary<int, IReadOnlyList<string>> (fully read-only)
public IReadOnlyDictionary<int, IReadOnlyList<string>> NumberNames => _numberNames.AsReadOnlyDictionaryOfList();

// Expose as IReadOnlyDictionary<int, ICollection<string>>
// Expose as .NET IReadOnlyDictionary<int, ICollection<string>>
public IReadOnlyDictionary<int, ICollection<string>> NumberNames => _numberNames.AsDictionaryOfCollection();

// Expose as IReadOnlyDictionary<int, IReadOnlyCollection<string>>
// Expose as .NET IReadOnlyDictionary<int, IReadOnlyCollection<string>>
public IReadOnlyDictionary<int, IReadOnlyCollection<string>> NumberNames => _numberNames.AsReadOnlyDictionaryOfCollection();
}
```
Expand Down
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@
| Library | Package |
| --- | --- |
| **Singulink.Collections** | [![View nuget packages](https://img.shields.io/nuget/v/Singulink.Collections.svg)](https://www.nuget.org/packages/Singulink.Collections/) |
| **Singulink.Collections.Abstractions** | [![View nuget packages](https://img.shields.io/nuget/v/Singulink.Collections.Abstractions.svg)](https://www.nuget.org/packages/Singulink.Collections.Abstractions/) |
| **Singulink.Collections.Weak** | [![View nuget packages](https://img.shields.io/nuget/v/Singulink.Collections.Weak.svg)](https://www.nuget.org/packages/Singulink.Collections.Weak/) |

**Singulink.Collections** provides generally useful collections that are missing from .NET. They are highly optimized for performance, well documented and follow the same design principles as built-in .NET collections so they should feel instantly familiar.

The following collections are included in **Singulink.Collections**:
- `Map`: Collection of two types of values that map between each other in a bidirectional one-to-one relationship.
The following collections are included in the package:
- `HashSetDictionary`: Collection of keys mapped to a hash set of unique values per key.
- `ListDictionary`: Collection of keys mapped to a list of values per key.
- `Map`: Collection of two types of values that map between each other in a bidirectional one-to-one relationship.
- `ReadOnlyHashSet`: Fast read-only wrapper around a HashSet (instead of going through `ISet<>`).
- `ReadOnlyList`: Fast read-only wrapper around a List (instead of going through `IList<>`).

**Singulink.Collections.Abstractions** provides a full set of interfaces for the new collections as well as an `IReadOnlySet` polyfill for .NET Standard.
- A full set of interfaces for the new collections as well as an `IReadOnlySet<>` polyfill for .NET Standard.

**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.

The following collections are included in **Singulink.Collections.Weak**:
The following collections are included in the package:
- `WeakCollection`: Collection of weakly referenced values that keeps items in an undefined order.
- `WeakList`: Collection of weakly referenced values that maintains relative insertion order.
- `WeakValueDictionary`: Collection of keys and weakly referenced values.
Expand All @@ -35,7 +33,7 @@ This package is part of our **Singulink Libraries** collection. Visit https://gi

## Installation

The packages are available on NuGet - simply install the **Singulink.Collections**, **Singulink.Collections.Abstractions** and/or **Singulink.Collections.Weak** packages.
The packages are available on NuGet - simply install the `Singulink.Collections` and/or `Singulink.Collections.Weak` packages.

**Supported Runtimes**: Everywhere .NET Standard 2.0 is supported, including:
- .NET
Expand Down Expand Up @@ -99,31 +97,31 @@ public class YourClass
{
private ListDictionary<int, string> _numberNames;

// Expose as IListDictionary (with IList<string> values)
// Expose as Singulink IListDictionary (with .NET IList<string> values)
public IListDictionary<int, string> NumberNames => _numberNames;

// Expose as IReadOnlyListDictionary (with IReadOnlyList<string> values)
// Expose as Singulink IReadOnlyListDictionary (with .NET IReadOnlyList<string> values)
public IReadOnlyListDictionary<int, string> NumberNames => _numberNames.AsReadOnly();

// Expose as ICollectionDictionary (with ICollection<string> values)
// Expose as Singulink ICollectionDictionary (with .NET ICollection<string> values)
public ICollectionDictionary<int, string> NumberNames => _numberNames.AsCollectionDictionary();

// Expose as IReadOnlyCollectionDictionary (with IReadOnlyCollection<string> values)
// Expose as Singulink IReadOnlyCollectionDictionary (with .NET IReadOnlyCollection<string> values)
public IReadOnlyCollectionDictionary<int, string> NumberNames => _numberNames.AsReadOnlyCollectionDictionary();

// Expose as IReadOnlyDictionary<int, IList<string>>
// Expose as .NET IReadOnlyDictionary<int, IList<string>>
// Note that values can still be added/removed/modified through the value ILists even though it is
// an IReadOnlyDictionary. Many of the additional API's present in the IDictionary interface are
// not sensible in the context of a collection dictionary so that interface is not supported.
public IReadOnlyDictionary<int, IList<string>> NumberNames => _numberNames;

// Expose as IReadOnlyDictionary<int, IReadOnlyList<string>> (fully read-only)
// Expose as .NET IReadOnlyDictionary<int, IReadOnlyList<string>> (fully read-only)
public IReadOnlyDictionary<int, IReadOnlyList<string>> NumberNames => _numberNames.AsReadOnlyDictionaryOfList();

// Expose as IReadOnlyDictionary<int, ICollection<string>>
// Expose as .NET IReadOnlyDictionary<int, ICollection<string>>
public IReadOnlyDictionary<int, ICollection<string>> NumberNames => _numberNames.AsDictionaryOfCollection();

// Expose as IReadOnlyDictionary<int, IReadOnlyCollection<string>>
// Expose as .NET IReadOnlyDictionary<int, IReadOnlyCollection<string>>
public IReadOnlyDictionary<int, IReadOnlyCollection<string>> NumberNames => _numberNames.AsReadOnlyDictionaryOfCollection();
}
```
Expand Down

0 comments on commit d7e99c9

Please sign in to comment.