CsEffect.Core 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CsEffect.Core --version 0.3.0
                    
NuGet\Install-Package CsEffect.Core -Version 0.3.0
                    
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="CsEffect.Core" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CsEffect.Core" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="CsEffect.Core" />
                    
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 CsEffect.Core --version 0.3.0
                    
#r "nuget: CsEffect.Core, 0.3.0"
                    
#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 CsEffect.Core@0.3.0
                    
#: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=CsEffect.Core&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=CsEffect.Core&version=0.3.0
                    
Install as a Cake Tool

CsEffect.Core

Core types and abstractions for the CsEffect system.

Overview

CsEffect.Core provides the foundational types for defining and using effects without any analyzer dependencies. This lightweight package contains only the essential abstractions needed to create and consume effect-aware APIs.

Core Types

IO Base Class

public class IO { }

Base class for all effect definitions. All effects inherit from IO.

Generic Effect Attribute

[Effect<ConsoleEffect>]
public void WriteToConsole() { ... }

Type-safe attribute for declaring effects on methods and properties.

AttachEffect Attribute

[AttachEffect(typeof(Console), "WriteLine", "Write")]
public sealed class ConsoleEffect : IO { }

Attribute for attaching effects to existing types and specific members.

Effect Severity Control

[EffectSeverity(EffectViolationLevel.Error)]
public sealed class CriticalEffect : IO { }

Configures whether effect violations are warnings or errors.

Usage

Defining Effects

// Base effect for console operations
public class ConsoleEffect : IO { }

// Specific console write effect
[AttachEffect(typeof(Console), "WriteLine", "Write")]
public sealed class ConsoleWriteEffect : ConsoleEffect { }

Using Effects

[Effect<ConsoleWriteEffect>]
public void LogMessage(string message)
{
    Console.WriteLine(message);
}

// Effect hierarchy - IO satisfies ConsoleWriteEffect
[Effect<IO>]
public void DoLogging()
{
    LogMessage("This works due to effect hierarchy");
}

Multiple Effects

[Effect<ConsoleWriteEffect>, Effect<FileWriteEffect>]
public void LogToConsoleAndFile(string message)
{
    Console.WriteLine(message);
    File.WriteAllText("log.txt", message);
}

Benefits

  • đŸĒļ Lightweight: No analyzer or Roslyn dependencies
  • đŸŽ¯ Pure: Only contains type definitions and attributes
  • 🔄 Reusable: Can be used in any .NET project
  • đŸ—ī¸ Foundational: Base for building effect libraries
  • ⚡ Fast: Minimal runtime overhead

Integration

This package is designed to work with:

  • CsEffect.System: Pre-built system effects (Console, File, HTTP)
  • CsEffect.Analyzer: Development-time effect analysis
  • CsEffect: Combined package with analyzer and code fixes

Creating Effect Libraries

// 1. Reference CsEffect.Core
// 2. Define your domain effects
[AttachEffect(typeof(Database), "Execute", "Query")]
public sealed class DatabaseEffect : IO { }

// 3. Use in your APIs
[Effect<DatabaseEffect>]
public User GetUser(int id) => database.Query<User>(id);

License

MIT

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 was computed.  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 was computed.  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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CsEffect.Core:

Package Downloads
CsEffect.System

Reference effect attribute library providing built-in system-oriented effects for CsEffect consumers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.15.0 236 10/13/2025
0.14.0 220 10/13/2025
0.13.0 212 10/13/2025
0.12.0 222 10/13/2025
0.11.0 222 10/13/2025
0.10.0 232 10/12/2025
0.9.0 238 10/12/2025
0.8.0 221 10/12/2025
0.7.0 219 10/12/2025
0.6.0 206 10/12/2025
0.5.0 212 10/12/2025
0.4.0 210 10/12/2025
0.3.0 157 10/11/2025
0.2.0 160 10/11/2025
0.2.0-alpha.12 84 10/11/2025
0.1.0 129 10/11/2025
0.0.0 162 10/11/2025