ExtendedSharp.Sdk 0.1.2

dotnet add package ExtendedSharp.Sdk --version 0.1.2
                    
NuGet\Install-Package ExtendedSharp.Sdk -Version 0.1.2
                    
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="ExtendedSharp.Sdk" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExtendedSharp.Sdk" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="ExtendedSharp.Sdk" />
                    
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 ExtendedSharp.Sdk --version 0.1.2
                    
#r "nuget: ExtendedSharp.Sdk, 0.1.2"
                    
#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 ExtendedSharp.Sdk@0.1.2
                    
#: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=ExtendedSharp.Sdk&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=ExtendedSharp.Sdk&version=0.1.2
                    
Install as a Cake Tool

ExtendedSharp (E#)

ExtendedSharp is a high-performance, token-based C# code parsing and transformation framework. It allows precise tokenization, formatting, and transformation of C# (and custom syntax) with minimal overhead. Designed for building linters, transpilers, code generators, and other developer tooling.


Performance

Operation Time (ms)
Parsing (large file) 5.735
Transforming (large file) 0.413

Features

  • Fast Parsing & Transforming
    Optimized for performance: parsing takes milliseconds even for large files.

  • Token-Based Architecture
    Each piece of code is tokenized into objects with metadata (line, column, type) for accurate transformation.

  • Custom Token & Character Handlers
    Extend E# with your own token types or character handlers without modifying core logic.

  • Flexible Code Transformation
    Use ITokenTransformer implementations to format, rewrite, or transform code efficiently.

  • Indentation & Whitespace Management
    Handles indentation, spacing, and newlines automatically with support for block-level constructs ({}, etc.).

  • Modular Design
    JSX or other syntax extensions can be added via separate libraries without bloating the core.


Usage

Tokenizing Code

using ExtendedSharp.Sdk;

var code = @"
public class Example {
    public void SayHello() {
        Console.WriteLine(""Hello, World!"");
    }
}";

var tokens = await CodeReader.ReadString(code);

Transforming Code

using ExtendedSharp.Sdk.CodeTransformer;

var formattedCode = Transformer.Transform(tokens);
Console.WriteLine(formattedCode);

Registering a Custom Transformer

Transformer.RegisterCustomTransformer(new MyCustomTransformer());

public class MyCustomTransformer : ITokenTransformer
{
    public bool CanTransform(Token<object> token) => token.TextualValue == "Console";

    public void Transform(Token<object> token, StringBuilder builder)
    {
        builder.Append("System.Console");
    }
}

Extending with Custom Syntax

CodeReader.RegisterCustomCharacterHandler('@', new MyAtSymbolHandler());

public class MyAtSymbolHandler : ICustomTokenCharacterHandler
{
    public bool CanHandle(ref TokenHandlerContext context)
    {
        return context.Source[context.Pointer] == '@';
    }

    public Token<object>? Handle(ref TokenHandlerContext context)
    {
        var token = new Token<object>
        {
            TextualValue = "@custom",
            Type = TokenType.Identifier,
            LineNumber = 0,
            ColumnNumber = 0,
            Index = context.PreviousTokens.Length
        };

        context.Advance(7); // advance pointer past token
        return token;
    }
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 236 11/9/2025
0.1.1 228 11/9/2025
0.1.0 175 11/8/2025