LikeComparison 2.4.1

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

NuGet Nuget Coverage Status

LikeComparison

LikeComparison is a C# library that enables string pattern matching using SQL-style LIKE expressions. It mimics the behavior of the LIKE operator found in SQL dialects, making it useful for many .NET use cases.

Key Features

  • Supports multiple SQL syntaxes:

  • Extension Methods:

    • Like() and ILike() for string comparisons
    • MSTest: Assert.That.IsLike() and IsILike()
    • Shouldly: ShouldBeLike() and ShouldBeILike()
  • Cross-platform compatibility:

    • .NET 8.0 and 10.0 (recommended)
    • .NET Standard 2.0 (experimental support with C# 8)

Using Like method on strings from LikeComparison package

You can simply use extension method on String class:

using LikeComparison.VisualBasic;
string? matchExpression = "abcdef";

bool isLike = matchExpression.Like(pattern: "a*");

or

using LikeComparison.TransactSql;
string? matchExpression = "abcdef";

// common use
bool isLike = matchExpression.Like(pattern: "a%");

// or with escape character
bool isLike = matchExpression.Like(pattern: "/a%", escapeCharacter: "/");

or

using LikeComparison.PostgreSql;
string? matchExpression = "abcdef";

// case-insensitive
bool isLike = matchExpression.ILike(pattern: "A%");

// or case-sensitive
bool isLike = matchExpression.Like(pattern: "a%");

Using IsLike method on MSTest assertions from LikeComparison.MSTest package

You can simply use extension method on Assert class:

using LikeComparison.VisualBasic;
string? matchExpression = "abcdef";

Assert.That.IsLike(matchExpression, pattern: "a*");

or

using LikeComparison.TransactSql;
string? matchExpression = "abcdef";

// common use
Assert.That.IsLike(matchExpression, pattern: "a%");

// or with escape character
Assert.That.IsLike(matchExpression, pattern: "/a%", escape: "/");

or

using LikeComparison.PostgreSql;
string? matchExpression = "abcdef";

// case-insensitive
Assert.That.IsILike(matchExpression, pattern: "A%");

// or case-sensitive
Assert.That.IsLike(matchExpression, pattern: "a%");

Using ShouldBeLike method on Shouldly assertions from LikeComparison.Shouldly package

You can simply use extension method on String class:

using LikeComparison.VisualBasic;
string? matchExpression = "abcdef";

matchExpression.ShouldBeLike(pattern: "a*");

or

using LikeComparison.TransactSql;
string? matchExpression = "abcdef";

// common use
matchExpression.ShouldBeLike(pattern: "a%");

// or with escape character
matchExpression.ShouldBeLike(pattern: "/a%", escape: "/");

or

using LikeComparison.PostgreSql;
string? matchExpression = "abcdef";

// case-insensitive
matchExpression.ShouldBeILike(pattern: "A%");

// or case-sensitive
matchExpression.ShouldBeLike(pattern: "a%");
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 is compatible.  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 is compatible.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on LikeComparison:

Package Downloads
LikeComparison.MSTest

LikeComparison is a library that allows you to compare a string expression to a pattern in an "SQL LIKE" expression. It supports many LIKE operator syntax: Visual Basic, Transact-SQL, PostgreSQL.

LikeComparison.Shouldly

LikeComparison is a library that allows you to compare a string expression to a pattern in an "SQL LIKE" expression. It supports many LIKE operator syntax: Visual Basic, Transact-SQL, PostgreSQL.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.4.1 182 3/10/2026
2.4.0 266 12/20/2025
2.3.2 447 6/24/2025
2.3.1 445 3/13/2025
2.3.0 429 11/20/2024
2.2.1 721 9/19/2024
2.2.0 1,320 1/23/2024
2.1.0 1,052 10/8/2023
2.0.1 508 7/26/2023
2.0.0 547 4/4/2023
1.3.3 1,655 3/16/2023
1.3.2 352 3/2/2023
1.3.1 613 11/27/2022
1.3.0 477 11/13/2022
1.2.1 865 6/21/2022
Loading failed