Lappa.Conventions 1.0.2

dotnet add package Lappa.Conventions --version 1.0.2
                    
NuGet\Install-Package Lappa.Conventions -Version 1.0.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="Lappa.Conventions" Version="1.0.2">
  <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="Lappa.Conventions" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Lappa.Conventions">
  <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 Lappa.Conventions --version 1.0.2
                    
#r "nuget: Lappa.Conventions, 1.0.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 Lappa.Conventions@1.0.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=Lappa.Conventions&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Lappa.Conventions&version=1.0.2
                    
Install as a Cake Tool

Lappa.Conventions

Opinionated C# project defaults providing:

  • Type aliases: int32, int64, uint8, float16, etc. via global using directives
  • Implicit null checks: Use if (obj) / if (!obj) instead of null checks (C# 14 / .NET 10+)
  • Analyzers + code fixes: Enforce consistent usage with auto-fixable warnings

Installation

<PackageReference Include="Lappa.Conventions" Version="1.0.2" PrivateAssets="all" />

The source generator injects the global usings and extensions, the analyzer enforces usage and default .editorconfig configuration is applied automatically.

What's included

Type aliases (generated automatically)

int32 count = 42;        // instead of int count = 42;
int64 bigNumber = 100L;  // instead of long bigNumber = 100L;
uint8 flags = 0xFF;      // instead of byte flags = 0xFF;
float16 small = 1.5f;    // instead of Half small = 1.5f;

All type mappings:

Alias C# Keyword CLR Type
int8 sbyte System.SByte
int16 short System.Int16
int32 int System.Int32
int64 long System.Int64
int128 System.Int128
uint8 byte System.Byte
uint16 ushort System.UInt16
uint32 uint System.UInt32
uint64 ulong System.UInt64
uint128 System.UInt128
float16 System.Half

Implicit Null Check (.NET 10+ only)

Test obj = new Test();

// instead of if (obj != null)
if (obj)           
{
    obj.DoWork();
    obj = null;
}

// instead of:if (obj == null)
if (!obj) 
{
    // Do stuff...
}

Analyzers

LACON001: Use type alias

Flags usage of built-in keywords (int, long, etc.) and CLR type names (System.Int32, etc.) when a type alias is available.

Severity: Error (default), configurable to warning or lower for less strict rules.

LACON002: Use implicit null check

Flags explicit null comparisons (obj != null, obj == null, obj is null, obj is not null) and suggests using implicit extension checks instead.

Severity: Warning (default), configurable.

Configuration

Severity can be changed if required. Override those in your .editorconfig:

[*.cs]
# Change severity (none | suggestion | warning | error)
dotnet_diagnostic.LACON001.severity = error
dotnet_diagnostic.LACON002.severity = warning

License

Copyright (c) Arctium. All rights reserved.

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.2 86 2/22/2026
1.0.1 85 2/22/2026
1.0.0 92 2/22/2026 1.0.0 is deprecated.