Dosaic.Extensions.Sqids 1.1.3

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

Dosaic.Extensions.Sqids

Dosaic.Extensions.Sqids is an extension library that provides methods to convert strings to and from Sqid format using the Sqids library.

Installation

To install the nuget package follow these steps:

dotnet add package Dosaic.Extensions.Sqids

or add as package reference to your .csproj

<PackageReference Include="Dosaic.Extensions.Sqids" Version="" />

Usage

The extension provides simple methods to convert strings to and from Sqid format.

Basic Conversion

Convert a string to a Sqid:

using Dosaic.Extensions.Sqids;

string originalString = "HelloWorld";
string sqidString = originalString.ToSqid();

Convert a Sqid back to the original string:

using Dosaic.Extensions.Sqids;

string sqidString = "kKs7PVdXUYnH"; // Example sqid
string originalString = sqidString.FromSqid();

Custom Encoder

You can also use a custom encoder for special use cases:

using Dosaic.Extensions.Sqids;
using Sqids;

var customEncoder = new SqidsEncoder<char>(new SqidsOptions
{
    Alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    MinLength = 8
});

string originalString = "HelloWorld";
string sqidString = originalString.ToSqid(customEncoder);
string decodedString = sqidString.FromSqid(customEncoder);

Default Configuration

By default, the extension uses the following configuration:

  • Alphabet: "kKsW7PVdXUYnHgQ6rujl0GepfNzB2qZ9bC83IyDmOAtJ4hcSvM1Roaw5LxEiTF"
  • Minimum Length: 10

You can modify the default encoder if needed:

using Dosaic.Extensions.Sqids;
using Sqids;

SqidExtensions.Encoder = new SqidsEncoder<char>(new SqidsOptions
{
    Alphabet = "yourCustomAlphabet",
    MinLength = 12
});

Use Cases

Sqids are useful for:

  • Creating URL-friendly identifiers
  • Obfuscating sequential IDs
  • Generating short, unique string identifiers
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

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Dosaic.Extensions.Sqids:

Package Downloads
Dosaic.Plugins.Persistence.S3

A plugin-first dotnet framework for rapidly building anything hosted in the web.

Dosaic.Plugins.Persistence.VaultSharp

A plugin-first dotnet framework for rapidly building anything hosted in the web.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.3 116 5/23/2025
1.1.2 154 5/8/2025
1.1.1 148 5/6/2025
1.1.0 108 5/2/2025