Functional programming support for C#

PureSharp

A Roslyn-based toolset that brings compile-time checks for referential transparency, local-variable immutability, and safer functional-style control flow to C#.

PureSharp helps developers make purity and immutability explicit and mechanically verifiable instead of relying only on conventions and code review.

Get PureSharp on NuGet View on GitHub

What PureSharp checks

Referential transparency

Methods marked with [PureMethod] are checked for mutable static state, non-pure calls, and I/O operations.

Immutable local variables

Locals using PureSharp's underscore convention can be required to initialize once and never be reassigned.

Fluent conditional flow

Fluent.If chains are checked so incomplete conditional expressions do not silently escape validation.

Why use it?

C# supports functional programming techniques, but the language does not mechanically enforce referential transparency or immutable local variables. PureSharp uses Roslyn diagnostics to turn selected functional-programming constraints into build-time feedback.

Open source and configurable

Diagnostics use standard .editorconfig severity controls. PureSharp is MIT licensed and its analyzer behavior is documented in a versioned diagnostic contract.