johnverbiest.belgian.insz 1.1.3

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

Belgian INSZ/NISS Number Validator

NuGet License

A robust .NET library for validating, parsing, and working with Belgian national identification numbers (INSZ/NISS/RRN/BIS). Provides comprehensive validation, data extraction (birth date, sex, BIS detection), and supports multiple input formats. Thread-safe with zero dependencies.

πŸ“‹ What is INSZ/NISS?

INSZ (Identificatienummer van de Sociale Zekerheid) or NISS (NumΓ©ro d'Identification de la SΓ©curitΓ© Sociale), also known as:

  • RRN (Rijksregisternummer / NumΓ©ro de Registre National) - Regular national registry number
  • BIS (Bis-nummer) - Temporary number for non-residents

These are unique 11-digit identification numbers assigned to individuals in Belgium.

✨ Features

  • βœ… Complete Validation - Validates format, length, checksum, date, and sequence number
  • πŸ“… Birth Date Extraction - Extracts birth date and year from valid numbers
  • πŸ‘€ Sex Detection - Determines sex (Male/Female/Unknown) from sequence number
  • πŸ” BIS Detection - Identifies temporary BIS numbers vs regular RRN
  • 🎯 Type-Safe - Full .NET type support with comprehensive XML documentation
  • πŸ”„ Multiple Input Formats - Accepts strings, long integers, or InszNumber objects
  • πŸ“ Detailed Error Messages - Clear validation error reporting
  • 🧡 Thread-Safe - Safe for concurrent use with lazy-loaded properties
  • πŸš€ Zero Dependencies - Pure .NET Standard 2.0 implementation
  • πŸ’‰ DI-Friendly - Supports both static and instance usage with dependency injection

πŸ“¦ Installation

dotnet add package johnverbiest.belgian.insz
Install-Package johnverbiest.belgian.insz

πŸš€ Quick Start

using johnverbiest.belgian.insz;

// Validate a Belgian national number
var result = InszValidator.ValidateInsz("85073003328");

if (result.IsValid)
{
    Console.WriteLine("Valid INSZ number!");
    Console.WriteLine($"Birth Date: {result.InszNumber?.BirthDate}");
    Console.WriteLine($"Sex: {result.InszNumber?.Sex}");
    Console.WriteLine($"Is BIS: {result.InszNumber?.IsBis}");
}
else
{
    Console.WriteLine($"Invalid: {string.Join(", ", result.ValidationErrors)}");
}

πŸ“– Usage Examples

Basic Validation (Static Methods)

using johnverbiest.belgian.insz;

// Validate with formatted string
var result1 = InszValidator.ValidateInsz("85.07.30-033.28");
Console.WriteLine(result1.IsValid); // true

// Validate with unformatted string
var result2 = InszValidator.ValidateInsz("85073003328");
Console.WriteLine(result2.IsValid); // true

// Validate with long integer
var result3 = InszValidator.ValidateInsz(85073003328L);
Console.WriteLine(result3.IsValid); // true

// Validate with InszNumber object
var insz = new InszNumber { Value = 85073003328L };
var result4 = InszValidator.ValidateInsz(insz);
Console.WriteLine(result4.IsValid); // true

Dependency Injection Usage

using johnverbiest.belgian.insz;
using Microsoft.Extensions.DependencyInjection;

// Register in your DI container (e.g., in Program.cs)
services.AddSingleton<IInszValidator, InszValidator>();

// Inject into your service or controller
public class UserService
{
    private readonly IInszValidator _validator;
    
    public UserService(IInszValidator validator)
    {
        _validator = validator;
    }
    
    public bool ValidateUserInsz(string insz)
    {
        var result = _validator.Validate(insz);
        return result.IsValid;
    }
}

Extracting Information

using johnverbiest.belgian.insz;

var result = InszValidator.ValidateInsz("85073003328");

if (result.IsValid && result.InszNumber != null)
{
    var insz = result.InszNumber;
    
    // Access birth information
    Console.WriteLine($"Birth Date: {insz.BirthDate}"); // DateTime object
    Console.WriteLine($"Birth Year: {insz.BirthYear}"); // 1985
    
    // Check sex
    Console.WriteLine($"Sex: {insz.Sex}"); // Male, Female, or Unknown
    if (insz.Sex == Sex.Male)
    {
        Console.WriteLine("This is a male");
    }
    
    // Check if it's a BIS number
    Console.WriteLine($"Is BIS: {insz.IsBis}"); // false (regular RRN)
    
    // Get formatted string
    Console.WriteLine($"Formatted: {insz.ToFormattedString()}"); // "85.07.30-033.28"
    Console.WriteLine($"String: {insz.ToString()}"); // "85073003328"
    Console.WriteLine($"Value: {insz.Value}"); // 85073003328L
}

Working with BIS Numbers

using johnverbiest.belgian.insz;

// BIS numbers have month increased by 20 or 40
var result = InszValidator.ValidateInsz("85273003307"); // Month 27 = 07 + 20

if (result.IsValid && result.InszNumber != null)
{
    Console.WriteLine($"Is BIS: {result.InszNumber.IsBis}"); // true
    Console.WriteLine($"Birth Date: {result.InszNumber.BirthDate}"); // July 30, 1985
    Console.WriteLine($"Birth Year: {result.InszNumber.BirthYear}"); // 1985
}

Error Handling

using johnverbiest.belgian.insz;

var result = InszValidator.ValidateInsz("12345678901");

if (!result.IsValid)
{
    Console.WriteLine("Validation failed!");
    
    foreach (var error in result.ValidationErrors)
    {
        switch (error)
        {
            case ValidationError.InputIsNotANumber:
                Console.WriteLine("Input contains non-numeric characters");
                break;
            case ValidationError.InputIsWrongLength:
                Console.WriteLine("Input must be exactly 11 digits");
                break;
            case ValidationError.ChecksumIsInvalid:
                Console.WriteLine("Checksum validation failed");
                break;
            case ValidationError.DateIsInvalid:
                Console.WriteLine("Birth date is invalid");
                break;
            case ValidationError.InvalidSequenceNumber:
                Console.WriteLine("Sequence number is out of range");
                break;
        }
    }
}

Async/Await Pattern

using johnverbiest.belgian.insz;

public class InszService
{
    private readonly IInszValidator _validator;
    
    public InszService(IInszValidator validator)
    {
        _validator = validator;
    }
    
    public async Task<bool> ValidateInszAsync(string insz)
    {
        // Validation is synchronous and fast, but you can wrap it in Task.Run if needed
        return await Task.Run(() => _validator.Validate(insz).IsValid);
    }
}

ASP.NET Core Integration

using johnverbiest.belgian.insz;
using Microsoft.AspNetCore.Mvc;

// In Program.cs
builder.Services.AddSingleton<IInszValidator, InszValidator>();

// In your controller
[ApiController]
[Route("api/[controller]")]
public class ValidationController : ControllerBase
{
    private readonly IInszValidator _validator;
    
    public ValidationController(IInszValidator validator)
    {
        _validator = validator;
    }
    
    [HttpPost("validate")]
    public IActionResult ValidateInsz([FromBody] string insz)
    {
        var result = _validator.Validate(insz);
        
        if (result.IsValid)
        {
            return Ok(new
            {
                Valid = true,
                BirthDate = result.InszNumber?.BirthDate,
                Sex = result.InszNumber?.Sex?.ToString(),
                IsBis = result.InszNumber?.IsBis,
                Formatted = result.InszNumber?.ToFormattedString()
            });
        }
        
        return BadRequest(new
        {
            Valid = false,
            Errors = result.ValidationErrors.Select(e => e.ToString()).ToArray()
        });
    }
}

πŸ”§ API Reference

InszValidator Class

The main validator class providing both static and instance methods.

Static Methods
Method Description
ValidateInsz(string) Validates an INSZ number from a string. Accepts formatted or unformatted input.
ValidateInsz(long) Validates an INSZ number from a long integer.
ValidateInsz(InszNumber) Validates an INSZ number from an InszNumber object.
Instance Methods (IInszValidator)
Method Description
Validate(string) Validates an INSZ number from a string.
Validate(long) Validates an INSZ number from a long integer.
Validate(InszNumber) Validates an INSZ number from an InszNumber object.

InszValidationResult Class

Represents the result of an INSZ validation operation.

Properties
Property Type Description
IsValid bool Indicates whether the INSZ number is valid.
InszNumber InszNumber? The validated INSZ number object (null if invalid).
ValidationErrors ValidationError[] Array of validation errors if the number is invalid.

InszNumber Record

Represents a Belgian INSZ number with extracted information.

Properties
Property Type Description
Value long The numeric value of the INSZ (11 digits).
HasBeenValidated bool Whether this number has been validated.
IsValid bool? Validation result.
IsBis bool? Whether this is a BIS number.
BirthDate DateTime? Extracted birth date.
BirthYear int? Extracted birth year.
Sex Sex? Extracted sex.
Methods
Method Returns Description
ToString() string Returns the 11-digit string representation.
ToFormattedString() string Returns formatted string (XX.XX.XX-XXX.XX).

Sex Enum

public enum Sex
{
    Unknown = 0,
    Female = 1,
    Male = 2
}

ValidationError Enum

public enum ValidationError
{
    InputIsNotANumber,
    ChecksumIsInvalid,
    InputIsWrongLength,
    DateIsInvalid,
    InvalidSequenceNumber
}

🎯 INSZ Number Format

An INSZ number consists of 11 digits with the following structure:

YY MM DD SSS CC
β”‚  β”‚  β”‚  β”‚   └─ Check digits (2 digits)
β”‚  β”‚  β”‚  └───── Sequence number (3 digits, 001-998)
β”‚  β”‚  └──────── Day of birth (2 digits)
β”‚  └─────────── Month of birth or month placeholder (2 digits)
└────────────── Year of birth (2 digits)

Month Encoding

  • 00-12: Regular RRN with known sex
  • 20-32: BIS number with known sex (month + 20)
  • 40-52: Regular RRN with unknown sex (month + 40)
  • 60-72: BIS number with unknown sex (month + 60)

Sequence Number

  • Odd numbers (001, 003, 005, ...): Male
  • Even numbers (002, 004, 006, ...): Female
  • Range: 001-998

Checksum

The last 2 digits are calculated using modulo 97:

  • For dates before 2000: 97 - (first 9 digits % 97)
  • For dates after 2000: 97 - ((2 + first 9 digits) % 97)

πŸŽ“ Framework Support

This library targets .NET Standard 2.0, which means it's compatible with:

  • βœ… .NET Core 2.0 and later
  • βœ… .NET Framework 4.6.1 and later
  • βœ… .NET 5, 6, 7, 8, 9+
  • βœ… Mono 5.4 and later
  • βœ… Xamarin.iOS 10.14 and later
  • βœ… Xamarin.Android 8.0 and later
  • βœ… Universal Windows Platform 10.0.16299 and later

πŸ“š Additional Resources

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

John Verbiest

πŸ› Issues

Found a bug or have a feature request? Please open an issue on GitHub.

  • npm Version - TypeScript/JavaScript package for Node.js and browser applications

Made with ❀️ in Belgium

using johnverbiest.belgian.insz;

// Validate from string (with or without formatting)
var result = InszValidator.ValidateInsz("85.07.30-033.28");

if (result.IsValid)
{
    Console.WriteLine("βœ“ Valid INSZ number");
    var insz = result.InszNumber;
    Console.WriteLine($"Birth Year: {insz.BirthYear}");
    Console.WriteLine($"Birth Date: {insz.BirthDate?.ToShortDateString()}");
    Console.WriteLine($"Formatted: {insz.ToFormattedString()}");
}
else
{
    Console.WriteLine("βœ— Invalid INSZ number");
    foreach (var error in result.ValidationErrors)
    {
        Console.WriteLine($"  - {error}");
    }
}

// Validate from long integer
var result2 = InszValidator.ValidateInsz(85073003328L);

// Validate from InszNumber object
var inszNumber = new InszNumber { Value = 85073003328L };
var result3 = InszValidator.ValidateInsz(inszNumber);

Instance Usage (Dependency Injection)

For applications using dependency injection, create an instance of InszValidator and use the interface:

using johnverbiest.belgian.insz;

// Register in your DI container (e.g., in Startup.cs or Program.cs)
services.AddSingleton<IInszValidator, InszValidator>();

// Inject into your service or controller
public class MyService
{
    private readonly IInszValidator _validator;
    
    public MyService(IInszValidator validator)
    {
        _validator = validator;
    }
    
    public bool ValidateUserInsz(string insz)
    {
        var result = _validator.Validate(insz);
        return result.IsValid;
    }
    
    public InszValidationResult GetValidationDetails(long inszNumber)
    {
        return _validator.Validate(inszNumber);
    }
}

πŸ” API Reference

InszValidator Class

The main validator class providing both static and instance methods.

Static Methods
Method Description
ValidateInsz(string) Validates an INSZ number from a string. Accepts formatted or unformatted input.
ValidateInsz(long) Validates an INSZ number from a long integer.
ValidateInsz(InszNumber) Validates an INSZ number from an InszNumber object.
Instance Methods (IInszValidator)
Method Description
Validate(string) Validates an INSZ number from a string. Delegates to static method.
Validate(long) Validates an INSZ number from a long integer. Delegates to static method.
Validate(InszNumber) Validates an INSZ number from an InszNumber object. Delegates to static method.

InszValidationResult Class

Represents the result of an INSZ validation operation.

Properties
Property Type Description
IsValid bool Indicates whether the INSZ number is valid.
InszNumber InszNumber? The validated INSZ number object (null if invalid).
ValidationErrors ValidationError[] Array of validation errors if the number is invalid.

InszNumber Record

Represents a validated Belgian INSZ number with parsed components.

Properties
Property Type Description
Value long The raw 11-digit INSZ number as a long integer.
HasBeenValidated bool Indicates if the number has been processed through validation.
IsValid bool? Validation status: true if valid, false if invalid, null if not validated.
BirthDate DateTime? The extracted birth date (null if invalid or unknown).
BirthYear int? The extracted birth year (null if invalid or unknown).
IsBis bool? Indicates if this is a BIS number (null if not validated).
Sex Sex? The determined sex (Male/Female/Unknown, null if not validated).
Methods
Method Return Type Description
ToString() string Returns the unformatted 11-digit INSZ number.
ToFormattedString() string? Returns the formatted INSZ number (YY.MM.DD-NNN.CC) or null if invalid.

ValidationError Enum

Enumeration of possible validation errors.

Value Description
InputIsNotANumber The input contains non-numeric characters.
ChecksumIsInvalid The checksum validation failed.
InputIsWrongLength The input is not exactly 11 digits.
DateIsInvalid The date portion is not a valid date.
InvalidSequenceNumber The sequence number is 000 or 999 (reserved values).

Sex Enum

Enumeration representing the sex/gender extracted from an INSZ number.

Value Description
Unknown Sex cannot be determined (regular INSZ or BIS with unknown sex).
Female Female (BIS numbers with known sex, even sequence number).
Male Male (BIS numbers with known sex, odd sequence number).

πŸ’‘ Detailed Examples

Example 1: Validating Different Input Formats

The validator accepts multiple input formats and automatically strips common formatting characters:

var validator = new InszValidator();

// All of these are valid and equivalent:
validator.Validate("85.07.30-033.28");  // Formatted
validator.Validate("85 07 30 033 28");  // Spaces
validator.Validate("85-07-30-033-28");  // Dashes
validator.Validate("85073003328");      // Unformatted
validator.Validate(85073003328L);       // Long integer

Example 2: Extracting Information

Once validated, you can extract various information from the INSZ number:

var result = InszValidator.ValidateInsz("85073003328");

if (result.IsValid)
{
    var insz = result.InszNumber;
    
    // Basic information
    Console.WriteLine($"Raw Value: {insz.Value}");              // 85073003328
    Console.WriteLine($"String: {insz.ToString()}");            // "85073003328"
    Console.WriteLine($"Formatted: {insz.ToFormattedString()}"); // "85.07.30-033.28"
    
    // Date information
    Console.WriteLine($"Birth Date: {insz.BirthDate}");         // 30/07/1985
    Console.WriteLine($"Birth Year: {insz.BirthYear}");         // 1985
    
    // Type and sex
    Console.WriteLine($"Is BIS Number: {insz.IsBis}");          // false
    Console.WriteLine($"Sex: {insz.Sex}");                       // Unknown (for regular numbers)
    
    // Validation status
    Console.WriteLine($"Is Valid: {insz.IsValid}");              // true
    Console.WriteLine($"Has Been Validated: {insz.HasBeenValidated}"); // true
}

Example 3: Working with BIS Numbers

BIS numbers are special identifiers for individuals not registered in the Belgian population register:

// BIS number with known sex (month + 40)
var result1 = InszValidator.ValidateInsz("85473003312");

if (result1.IsValid)
{
    var insz = result1.InszNumber;
    Console.WriteLine($"Is BIS: {insz.IsBis}");        // true
    Console.WriteLine($"Sex: {insz.Sex}");             // Male (odd sequence number)
    Console.WriteLine($"Birth Date: {insz.BirthDate}"); // Adjusted for BIS format
}

// BIS number with unknown sex (month + 20)
var result2 = InszValidator.ValidateInsz("85273003330");

if (result2.IsValid)
{
    var insz = result2.InszNumber;
    Console.WriteLine($"Is BIS: {insz.IsBis}");        // true
    Console.WriteLine($"Sex: {insz.Sex}");             // Unknown
}

Example 4: Comprehensive Error Handling

The library provides detailed validation errors:

var result = InszValidator.ValidateInsz("12345678901");

if (!result.IsValid)
{
    Console.WriteLine("Validation failed with the following errors:");
    
    foreach (var error in result.ValidationErrors)
    {
        switch (error)
        {
            case ValidationError.InputIsNotANumber:
                Console.WriteLine("- Input contains non-numeric characters");
                break;
            case ValidationError.ChecksumIsInvalid:
                Console.WriteLine("- Checksum validation failed");
                break;
            case ValidationError.InputIsWrongLength:
                Console.WriteLine("- Input must be exactly 11 digits");
                break;
            case ValidationError.DateIsInvalid:
                Console.WriteLine("- Date is not valid");
                break;
            case ValidationError.InvalidSequenceNumber:
                Console.WriteLine("- Sequence number is invalid (000 or 999)");
                break;
        }
    }
}

Example 5: Form Validation

Integrate INSZ validation into your application forms:

public class PersonForm
{
    public string InszNumber { get; set; }
    public string Name { get; set; }
}

public class PersonValidator
{
    private readonly IInszValidator _inszValidator;
    
    public PersonValidator(IInszValidator inszValidator)
    {
        _inszValidator = inszValidator;
    }
    
    public ValidationResult ValidateForm(PersonForm form)
    {
        var errors = new List<string>();
        
        // Validate INSZ number
        var inszResult = _inszValidator.Validate(form.InszNumber);
        if (!inszResult.IsValid)
        {
            var errorMessages = string.Join(", ", inszResult.ValidationErrors);
            errors.Add($"Invalid INSZ: {errorMessages}");
        }
        
        // Other validations...
        if (string.IsNullOrWhiteSpace(form.Name))
        {
            errors.Add("Name is required");
        }
        
        return new ValidationResult
        {
            IsValid = !errors.Any(),
            Errors = errors
        };
    }
}

Example 6: Data Processing and Enrichment

Automatically extract and enrich person data from INSZ numbers:

public class Person
{
    public long InszValue { get; set; }
    public string FormattedInsz { get; set; }
    public DateTime? BirthDate { get; set; }
    public int? Age { get; set; }
    public string Sex { get; set; }
    public bool IsBisNumber { get; set; }
}

public Person CreatePersonFromInsz(long inszValue)
{
    var result = InszValidator.ValidateInsz(inszValue);
    
    if (!result.IsValid)
        throw new ArgumentException("Invalid INSZ number", nameof(inszValue));
    
    var insz = result.InszNumber;
    
    return new Person
    {
        InszValue = insz.Value,
        FormattedInsz = insz.ToFormattedString(),
        BirthDate = insz.BirthDate,
        Age = insz.BirthDate.HasValue 
            ? DateTime.Today.Year - insz.BirthDate.Value.Year 
            : null,
        Sex = insz.Sex?.ToString() ?? "Unknown",
        IsBisNumber = insz.IsBis ?? false
    };
}

Example 7: Batch Validation

Validate multiple INSZ numbers efficiently:

public class BatchValidator
{
    private readonly IInszValidator _validator;
    
    public BatchValidator(IInszValidator validator)
    {
        _validator = validator;
    }
    
    public BatchValidationResult ValidateBatch(List<string> inszNumbers)
    {
        var results = new List<(string Insz, bool IsValid, string[] Errors)>();
        
        foreach (var insz in inszNumbers)
        {
            var result = _validator.Validate(insz);
            results.Add((
                insz, 
                result.IsValid,
                result.ValidationErrors.Select(e => e.ToString()).ToArray()
            ));
        }
        
        return new BatchValidationResult
        {
            TotalCount = results.Count,
            ValidCount = results.Count(r => r.IsValid),
            InvalidCount = results.Count(r => !r.IsValid),
            Results = results
        };
    }
}

// Usage with static method for simple scenarios
var inszNumbers = new[] { "85073003328", "12345678901", "00010112345" };
var validNumbers = inszNumbers
    .Where(insz => InszValidator.ValidateInsz(insz).IsValid)
    .ToList();

Example 8: Custom Validation Logic

Extend the validator with custom business rules:

public class CustomInszValidator : IInszValidator
{
    private readonly InszValidator _baseValidator = new();
    
    public InszValidationResult Validate(string inszString)
    {
        var result = _baseValidator.Validate(inszString);
        
        // Add custom validation: reject if person is under 18
        if (result.IsValid && result.InszNumber?.BirthDate != null)
        {
            var age = DateTime.Today.Year - result.InszNumber.BirthDate.Value.Year;
            if (age < 18)
            {
                // You could create a custom result type here
                Console.WriteLine("Warning: Person is under 18 years old");
            }
        }
        
        return result;
    }
    
    public InszValidationResult Validate(long inszNumber) 
        => Validate(inszNumber.ToString("D11"));
    
    public InszValidationResult Validate(InszNumber inszNumber) 
        => Validate(inszNumber.Value);
}

βœ… Validation Rules

The validator performs the following checks:

  1. Format Validation: Must be 11 numeric digits (formatting characters are automatically stripped)
  2. Checksum Validation: Modulo 97 validation with support for both pre-2000 and post-2000 birth dates
  3. Date Validation: The first 6 digits must form a valid date (with special handling for BIS numbers)
  4. Sequence Number Validation: Must be between 001 and 998 (000 and 999 are reserved)
  5. BIS Number Detection: Correctly identifies and validates BIS numbers with modified month values

Special Cases

  • BIS Numbers with Unknown Date: Month 00, Day 00 (birth date unknown but valid)
  • BIS Numbers with Unknown Year: Year 00, specific day patterns (partial date information)
  • Post-2000 Dates: Automatic detection based on checksum calculation

🎯 Features

  • βœ… Validates both regular INSZ and BIS numbers
  • βœ… Supports multiple input formats (string, long, formatted)
  • βœ… Static methods for simple scenarios
  • βœ… Instance methods for dependency injection
  • βœ… Extracts birth date and year with century detection
  • βœ… Determines sex from sequence number (where applicable)
  • βœ… Provides detailed validation error messages
  • βœ… Thread-safe with lazy-loaded properties
  • βœ… Supports .NET 8.0, .NET 6.0, and .NET Standard 2.0
  • βœ… Comprehensive XML documentation
  • βœ… Zero external dependencies

πŸ—οΈ Framework Support

  • .NET 8.0 - Latest LTS version with all features
  • .NET 6.0 - LTS version with full compatibility
  • .NET Standard 2.0 - Compatible with .NET Framework 4.6.1+, Xamarin, Unity, and more

πŸ”§ Advanced Topics

Thread Safety

All validation operations are thread-safe. The InszNumber record uses lazy-loaded properties with thread-safe initialization, making it safe to validate INSZ numbers concurrently.

var tasks = inszNumbers.Select(insz => 
    Task.Run(() => InszValidator.ValidateInsz(insz))
);
var results = await Task.WhenAll(tasks);

Performance Considerations

  • Static methods have no instantiation overhead
  • Lazy-loaded properties in InszNumber ensure efficient memory usage
  • Validation is fast: typically < 1ms per number

Null Safety

The library is designed with C# nullable reference types enabled:

  • All nullable returns are explicitly marked
  • Properties return null for invalid or unvalidated numbers
  • Use null-conditional operators when accessing properties
var result = InszValidator.ValidateInsz("85073003328");
var birthYear = result.InszNumber?.BirthYear ?? 0; // Safe access

πŸ“š Additional Resources

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is licensed under the Apache License 2.0


Made with ❀️ in Belgium

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 was computed.  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 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. 
.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.

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.1.3 79 1/2/2026
1.1.2 97 12/30/2025
1.1.1 70 12/21/2025
1.1.0 96 11/20/2025
1.0.1 91 11/20/2025
1.0.0 451 11/20/2025
0.1.0 95 11/19/2025

Initial .NET release (v0.1.0) with full INSZ/NISS validation, BIS number support, and data extraction capabilities. Version 1.0.0 will include npm package.