ChkComparable 1.0.5

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

detecting issues when you accidentally uses non comparable keys in Linq OrderBy method. For example,

using System;
using System.Collections.Generic;
using System.Linq;

namespace TestNamespace
{
    class TestClass
    {
        public void TestMethod()
        {
            var list = new List<Person>();
            var result = list.OrderByDescending(p => p); // Person is not comparable
        }
    }

    public class Person
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }
}

will compile successfully but throws an runtime exception System.ArgumentException: At least one object must implement IComparable.. The ChkComparable analyzer helps to catch this issues early.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
1.0.5 160 6/29/2025

Summary of changes made in this release of the package.