Synergy.Documentation.Annotations 4.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Synergy.Documentation.Annotations --version 4.0.1
                    
NuGet\Install-Package Synergy.Documentation.Annotations -Version 4.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Synergy.Documentation.Annotations" Version="4.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Synergy.Documentation.Annotations" Version="4.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Synergy.Documentation.Annotations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Synergy.Documentation.Annotations --version 4.0.1
                    
#r "nuget: Synergy.Documentation.Annotations, 4.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Synergy.Documentation.Annotations@4.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Synergy.Documentation.Annotations&version=4.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Synergy.Documentation.Annotations&version=4.0.1
                    
Install as a Cake Tool

Synergy.Documentation.Annotations

Synergy.Documentation.Annotations contains lightweight source annotations and fluent helpers for making important reasoning visible next to code. It can be used on its own or together with Synergy.Documentation.

NuGet: Synergy.Documentation.Annotations

License: MIT

Target frameworks: .NET Standard 2.0 (including .NET Framework 4.6.1+), .NET 8, and .NET 10

Install

dotnet add package Synergy.Documentation.Annotations

Add explanatory comments as code

The Note extension methods let you attach short explanations to expressions while leaving the expression's value unchanged:

using System.Collections.Generic;
using Synergy.Documentation.Annotations;

var capacity = 10.Because("the expected item count is known");
var items = new List<string>(capacity);

if (items.Count == 0)
    items.DoNothing("there are no items to process");

These helpers are intended for readability, not logging or runtime validation: they return the source value unchanged. Keep explanations focused on the reason or constraint that is not obvious from the code. Available helpers include Comment, Because, Then, But, Therefore, Otherwise, Moreover, Reference, Satisfies, DoNothing, DoNotThrowException, and And.

Associate a type with its source file

CodeFilePathAttribute captures a source file path at compile time. The main Synergy.Documentation package can use it with CodeFile.For<T>() to locate the file containing a type:

using Synergy.Documentation.Annotations;

[CodeFilePath]
public class MyDocumentedType
{
}

The attribute is conditional on the DOCUMENTATION compilation symbol. Define that symbol in the project where the annotated type is compiled if you need to retrieve its path:

<PropertyGroup>
  <DefineConstants>$(DefineConstants);DOCUMENTATION</DefineConstants>
</PropertyGroup>

Without that symbol, the compiler omits the attribute application, and CodeFile.For<T>() cannot find a source path for the type.

Examples

The repository's comments example demonstrates the fluent helpers. The Documentation package guide shows how source paths are used by its APIs.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Synergy.Documentation.Annotations:

Package Downloads
Synergy.Documentation

Generate Markdown documentation from .NET code, including public API listings, type dependency reports, TODO inventories, and composable Markdown documents.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2 373 11/6/2026
4.0.1 322 10/27/2026
3.0.35 547 10/13/2026
3.0.34 119 10/13/2026
3.0.32 549 9/19/2026
3.0.28 159 9/15/2026
3.0.26 346 8/27/2026
3.0.25 1,205 5/25/2026
3.0.24 286 5/11/2026
3.0.23 159 5/11/2026
3.0.21 461 4/17/2026
3.0.19 417 3/19/2026
3.0.18 1,161 9/16/2025
3.0.16 347 4/22/2025
3.0.15 306 4/22/2025
3.0.13 330 4/13/2025
3.0.12 281 3/20/2025
3.0.11 290 3/18/2025
3.0.10 417 2/21/2025
3.0.4 416 2/1/2024
Loading failed