Match Brackets - SQL to C# Plus

MatchBrackets is a lightweight .NET 6 / .NET 8 library that scans source or text input and produces a Dictionary<int,int> mapping each opening bracket to its closing counterpart. It supports (), {}, [] <> in a single pass for fast editor features like brace colorization, region highlighting, structural navigation, and safe extraction of bracketed spans.

Why use it:

  • Simple API: pass a string, get precise index pairs
  • Supports multi-targeting (net6.0, net8.0)
  • Eliminates manual stack handling boilerplate
  • Enables efficient syntax tools, refactor helpers, and code analysis extensions
  • MIT licensed, small footprint, no dependencies

Accelerate editor enhancements and parsing workflows by offloading bracket pairing logic to a focused, battle‑tested utility. Let your extension or analysis code work with clean structural boundaries instead of ad hoc scans.

Can also be found at NuGet.org


> dotnet add package MatchBrackets --version 1.0.5
An unhandled error has occurred. Reload 🗙