Skip to content

Commit 4241f1d

Browse files
authored
Merge pull request #92224 from dotnet/PackageREADMEsRelease80
[release/8.0] Add package readmes
2 parents 3e8b479 + f4d9074 commit 4241f1d

File tree

49 files changed

+3153
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3153
-68
lines changed

docs/coding-guidelines/libraries-packaging.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,47 @@ Packages can include a Markdown Readme file with a short usage documentation. To
5555
The package Readme is displayed on the package details page on [NuGet gallery](https://nuget.org/). You can include the following content in it:
5656

5757
- A description of the package purpose.
58+
- A list of package key features
59+
- A code example that demostrates how to use the package.
5860
- Information when package should be used. For example, if the library is included in the shared framework in .NET, but needs to be installed via NuGet on .NET Framework, it should be mentioned.
59-
- Information on how to get started with the package.
60-
- Links to related documentation.
6161
- A list of common entry-point types for the package, with links to their API docs under [.NET API Browser](https://learn.microsoft.com/dotnet/api/).
62-
- A short code example that demostrates the package usage.
62+
- Links to related documentation.
63+
- Information about how to provide feedback on the package and contribute to it.
64+
65+
Use the following Markdown template for a package Readme:
66+
67+
```
68+
## About
69+
70+
<!-- A description of the package and where one can find more documentation -->
71+
72+
## Key Features
73+
74+
<!-- The key features of this package -->
75+
76+
## How to Use
77+
78+
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
79+
80+
## Main Types
81+
82+
<!-- The main types provided in this library -->
83+
84+
## Additional Documentation
85+
86+
* [Conceptual documentation](...)
87+
* [API documentation](...)
88+
89+
## Related Packages
90+
91+
<!-- The related packages associated with this package -->
92+
93+
## Feedback & Contributing
94+
95+
<!-- How to provide feedback on this package and contribute to it -->
96+
97+
ExamplePackage is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
98+
```
6399

64100
For a list of supported Markdown features, see [NuGet documentation](https://learn.microsoft.com/nuget/nuget-org/package-readme-on-nuget-org#supported-markdown-features).
65101

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## About
2+
3+
As of C# 8, the C# language has support for producing and consuming asynchronous iterators. The library types in support of those features are available in .NET Core 3.0 and newer as well as in .NET Standard 2.1. This library provides the necessary definitions of those types to support these language features on .NET Framework and on .NET Standard 2.0. This library is not necessary nor recommended when targeting versions of .NET that include the relevant support.
4+
5+
## Key Features
6+
7+
<!-- The key features of this package -->
8+
9+
* Enables the use of C# async iterators on older .NET platforms
10+
11+
## How to Use
12+
13+
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
14+
15+
```C#
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Threading.Tasks;
19+
20+
internal static class Program
21+
{
22+
private static async Task Main()
23+
{
24+
Console.WriteLine("Starting...");
25+
await foreach (var value in GetValuesAsync())
26+
{
27+
Console.WriteLine(value);
28+
}
29+
Console.WriteLine("Finished!");
30+
31+
static async IAsyncEnumerable<int> GetValuesAsync()
32+
{
33+
for (int i = 0; i < 10; i++)
34+
{
35+
await Task.Delay(TimeSpan.FromSeconds(1));
36+
yield return i;
37+
}
38+
}
39+
}
40+
}
41+
```
42+
43+
## Main Types
44+
45+
<!-- The main types provided in this library -->
46+
47+
The main types provided by this library are:
48+
49+
* `IAsyncEnumerable<T>`
50+
* `IAsyncEnumerator<T>`
51+
* `IAsyncDisposable<T>`
52+
53+
## Additional Documentation
54+
55+
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
56+
57+
* [C# Feature Specification](https://learn.microsoft.com/dotnet/csharp/language-reference/proposals/csharp-8.0/async-streams)
58+
* [Walkthrough article](https://learn.microsoft.com/archive/msdn-magazine/2019/november/csharp-iterating-with-async-enumerables-in-csharp-8)
59+
60+
## Feedback & Contributing
61+
62+
<!-- How to provide feedback on this package and contribute to it -->
63+
64+
Microsoft.Bcl.AsyncInterfaces is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## About
2+
3+
As of .NET Core 2.0 and .NET Standard 2.1, the C# language has support for math (System.MathF) functions with floats. This library provides the necessary definitions of those types to support these language features on .NET Framework and on .NET Standard 2.0. This library is not necessary nor recommended when targeting versions of .NET that include the relevant support.
4+
5+
## Key Features
6+
7+
<!-- The key features of this package -->
8+
9+
* Enables the use of MathF on older .NET platforms
10+
11+
## How to Use
12+
13+
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
14+
15+
```C#
16+
using System;
17+
18+
internal static class Program
19+
{
20+
private static async Task Main()
21+
{
22+
Console.WriteLine(MathF.Max(1f, 5f)); // returns 5f
23+
}
24+
}
25+
```
26+
27+
## Main Types
28+
29+
<!-- The main types provided in this library -->
30+
31+
The main types provided by this library are:
32+
33+
* `System.MathF`
34+
35+
## Additional Documentation
36+
37+
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
38+
39+
* [API documentation](https://learn.microsoft.com/dotnet/api/system.mathf)
40+
41+
## Feedback & Contributing
42+
43+
<!-- How to provide feedback on this package and contribute to it -->
44+
45+
Microsoft.Bcl.Numerics is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## About
2+
3+
Microsoft.Bcl.TimeProvider provides time abstraction support for apps targeting .NET 7 and earlier, as well as those intended for the .NET Framework. For apps targeting .NET 8 and newer versions, referencing this package is unnecessary, as the types it contains are already included in the .NET 8 and higher platform versions.
4+
5+
## Key Features
6+
7+
* Provides a common abstraction for time-related operations.
8+
9+
## How to Use
10+
11+
```csharp
12+
using System;
13+
14+
// A class that uses TimeProvider to get the current time in Utc coordinates
15+
public class UtcClock
16+
{
17+
private readonly TimeProvider _timeProvider;
18+
19+
// Constructor that takes a TimeProvider as a dependency
20+
public Clock(TimeProvider timeProvider)
21+
{
22+
_timeProvider = timeProvider;
23+
}
24+
25+
// A method that returns the current time as a string
26+
public string GetTime()
27+
{
28+
return _timeProvider.GetLocalNow().ToString("HH:mm:ss");
29+
}
30+
}
31+
32+
// A class that inherits from TimeProvider and overrides the GetLocalNow method
33+
public class UtcTimeProvider : TimeProvider
34+
{
35+
// Override the GetLocalNow method to always return UTC time
36+
public override DateTimeOffset GetLocalNow()
37+
{
38+
return TimeProvider.System.GetUtcNow();
39+
}
40+
}
41+
42+
```
43+
44+
## Main Types
45+
46+
The main types provided by this library are:
47+
48+
* `TimeProvider`
49+
* `TimeProviderTaskExtensions`
50+
51+
## Additional Documentation
52+
53+
* [API documentation](https://learn.microsoft.com/dotnet/api/system.timeprovider)
54+
55+
## Feedback & Contributing
56+
57+
Microsoft.Bcl.TimeProvider is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
## About
2+
3+
<!-- A description of the package and where one can find more documentation -->
4+
5+
Provides implementations for local and distributed in-memory cache. It stores and retrieves data in a fast and efficient way.
6+
7+
## Key Features
8+
9+
<!-- The key features of this package -->
10+
11+
* A concrete implementation of the IMemoryCache interface, which represents a local in-memory cache that stores and retrieves data in a fast and efficient way
12+
* A distributed cache that supports higher scale-out than local cache
13+
* Expiration and eviction policies for its entries
14+
* Entry prioritization for when the cache size limit is exceeded and needs to be compacted by entry eviction
15+
* Track of cache statictics
16+
17+
## How to Use
18+
19+
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
20+
21+
Use Microsoft.Extensions.Caching.Memory over System.Runtime.Caching when working with ASP.NET Core as it provides better integration support. For example, IMemoryCache works natively with ASP.NET Core dependency injection.
22+
23+
Local in-memory serialization:
24+
```csharp
25+
using Microsoft.Extensions.Caching.Memory;
26+
27+
using MemoryCache cache = new(new MemoryCacheOptions());
28+
29+
object valueToCache = new();
30+
string key = "key";
31+
32+
using (ICacheEntry entry = cache.CreateEntry(key))
33+
{
34+
// Entries are committed after they are disposed therefore it does not exist yet.
35+
Console.WriteLine($"Exists: {cache.TryGetValue(key, out _)}\n");
36+
37+
entry.Value = valueToCache;
38+
entry.SlidingExpiration = TimeSpan.FromSeconds(2);
39+
}
40+
41+
bool exists = cache.TryGetValue(key, out object? cachedValue);
42+
Console.WriteLine($"Exists: {exists}" );
43+
Console.WriteLine($"cachedValue is valueToCache? {object.ReferenceEquals(cachedValue, valueToCache)}\n");
44+
45+
Console.WriteLine("Wait for the sliding expiration...");
46+
Thread.Sleep(TimeSpan.FromSeconds(2));
47+
48+
Console.WriteLine("Exists: " + cache.TryGetValue(key, out _));
49+
50+
// You can also use the acceleration extensions to set and get entries
51+
string key2 = "key2";
52+
object value2 = new();
53+
54+
cache.Set("key2", value2);
55+
56+
object? cachedValue2 = cache.Get(key2);
57+
Console.WriteLine($"cachedValue2 is value2? {object.ReferenceEquals(cachedValue2, value2)}");
58+
```
59+
60+
## Main Types
61+
62+
<!-- The main types provided in this library -->
63+
64+
The main types provided by this library are:
65+
66+
* `Microsoft.Extensions.Caching.Memory.MemoryCache`
67+
* `Microsoft.Extensions.Caching.Memory.MemoryCacheOptions`
68+
* `Microsoft.Extensions.Caching.Distributed.MemoryDistributedCache`
69+
* `Microsoft.Extensions.Caching.Memory.MemoryDistributedCacheOptions`
70+
71+
## Additional Documentation
72+
73+
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
74+
75+
* [Conceptual documentation](https://learn.microsoft.com/dotnet/core/extensions/caching)
76+
* [Cache in-memory in ASP.NET Core](https://learn.microsoft.com/aspnet/core/performance/caching/memory)
77+
* [API documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.caching.memory)
78+
79+
## Related Packages
80+
81+
<!-- The related packages associated with this package -->
82+
83+
[Microsoft.Extensions.Caching.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Abstractions)
84+
85+
## Feedback & Contributing
86+
87+
<!-- How to provide feedback on this package and contribute to it -->
88+
89+
Microsoft.Extensions.Caching.Memory is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).

src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/PACKAGE.md

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
## About
22

3+
<!-- A description of the package and where one can find more documentation -->
4+
35
Provides abstractions of key-value pair based configuration. Interfaces defined in this package are implemented by classes in [Microsoft.Extensions.Configuration](https://www.nuget.org/packages/Microsoft.Extensions.Configuration/) and other configuration packages.
46

5-
Commonly used types:
7+
## Key Features
8+
9+
<!-- The key features of this package -->
610

7-
- [Microsoft.Extensions.Configuration.IConfiguration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration)
8-
- [Microsoft.Extensions.Configuration.IConfigurationBuilder](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfigurationbuilder)
9-
- [Microsoft.Extensions.Configuration.IConfigurationProvider](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfigurationprovider)
10-
- [Microsoft.Extensions.Configuration.IConfigurationRoot](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfigurationroot)
11-
- [Microsoft.Extensions.Configuration.IConfigurationSection](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfigurationsection)
11+
* Abstractions for string key-value pair configuration sources and sections
12+
* Path conventions of keys establishing a heirachy of values
13+
* Support for multiple configuration sources, aggregating and defining precdence for values
14+
* Support for reload on change
1215

13-
For more information, see the documentation: [Configuration in .NET](https://learn.microsoft.com/dotnet/core/extensions/configuration).
16+
## How to Use
1417

15-
## Example
18+
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
1619

1720
The example below shows a small code sample using this library and trying out the `ConfigurationKeyName` attribute available since .NET 6:
1821

@@ -39,3 +42,41 @@ var config = new ConfigurationBuilder()
3942
var options = config.Get<MyClass>();
4043
Console.WriteLine(options.NamedProperty); // returns "value for named property"
4144
```
45+
46+
## Main Types
47+
48+
<!-- The main types provided in this library -->
49+
50+
The main types provided by this library are:
51+
52+
* `Microsoft.Extensions.Configuration.IConfiguration`
53+
* `Microsoft.Extensions.Configuration.IConfigurationBuilder`
54+
* `Microsoft.Extensions.Configuration.IConfigurationProvider`
55+
* `Microsoft.Extensions.Configuration.IConfigurationRoot`
56+
* `Microsoft.Extensions.Configuration.IConfigurationSection`
57+
58+
## Additional Documentation
59+
60+
<!-- Links to further documentation -->
61+
62+
* [Configuration in .NET](https://learn.microsoft.com/dotnet/core/extensions/configuration)
63+
* [API documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration)
64+
65+
## Related Packages
66+
67+
<!-- The related packages associated with this package -->
68+
* [Microsoft.Extensions.Configuration](https://www.nuget.org/packages/Microsoft.Extensions.Configuration)
69+
* [Microsoft.Extensions.Configuration.Binder](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Binder)
70+
* [Microsoft.Extensions.Configuration.CommandLine](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.CommandLine)
71+
* [Microsoft.Extensions.Configuration.EnvironmentVariables](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.EnvironmentVariables)
72+
* [Microsoft.Extensions.Configuration.FileExtensions](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.FileExtensions)
73+
* [Microsoft.Extensions.Configuration.Ini](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Ini)
74+
* [Microsoft.Extensions.Configuration.Json](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Json)
75+
* [Microsoft.Extensions.Configuration.UserSecrets](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.UserSecrets)
76+
* [Microsoft.Extensions.Configuration.Xml](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Xml)
77+
78+
## Feedback & Contributing
79+
80+
<!-- How to provide feedback on this package and contribute to it -->
81+
82+
Microsoft.Extensions.Caching.Abstractions is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).

0 commit comments

Comments
 (0)