UNLowCoder.SourceGen 0.0.3

dotnet add package UNLowCoder.SourceGen --version 0.0.3                
NuGet\Install-Package UNLowCoder.SourceGen -Version 0.0.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="UNLowCoder.SourceGen" Version="0.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UNLowCoder.SourceGen --version 0.0.3                
#r "nuget: UNLowCoder.SourceGen, 0.0.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.
// Install UNLowCoder.SourceGen as a Cake Addin
#addin nuget:?package=UNLowCoder.SourceGen&version=0.0.3

// Install UNLowCoder.SourceGen as a Cake Tool
#tool nuget:?package=UNLowCoder.SourceGen&version=0.0.3                

UnLowCoder.SourceGen

NuGet

Simple package to generate UNLocode classes from official unece csv zip package. The zip file can be downloaded from here or use this direct link

This package is a source generator that generates classes for the UNLocode csv files. The generated classes are readonly and can be used to access the data in the csv files. For parsing this package uses the UNLowCoder.Core package.

Implemented via C# source generators

Also this package is used by UNLowCoder.Lib that provides the generated classes for the UNLocode csv files.

Usage

Install the nuget package

Add a Nuget package reference to the project file in the project you want to generate unlocodes in:<br>

<PackageReference Include="UNLowCoder.SourceGen" Version="<version>" />

Add the downloaded unlocodes csv zip file to your project

You should rename the zip file to the class name you want to generate. For example UNLOCODE.zip creates the classes UNLOCODE.<br>

In an ItemGroup in your csproj file add an AdditionFiles element for each unlocode zip file you want to generate classes for Set the Include attribute to the path of the file.

Example:

<Project Sdk="Microsoft.NET.Sdk">

  <ItemGroup>
    <AdditionalFiles Include="UnLocodes.zip" />
  </ItemGroup>

</Project>

You can then use the generated classes in your code like this.

var all_countries = UnLocodes.Countries.All;
var current = UnLocodes.Countries.Get(CultureInfo.CurrentCulture);

var germanLocations = UnLocodes.Locations.DE.All;
var location_HAM_ = UnLocodes.Locations.DE.HAM;
var allLocations = UnLocodes.Locations.All;

var allDivisions = UnLocodes.Subdivisions.All;
var division_german_hh = UnLocodes.Subdivisions.DE.DE_HH;

For sure you can also parse another csv zip file at runtime.

var all = UnLocodeParser.ParseZipArchive("C:\Directory\loc241csv.zip");

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
0.0.3 25 1/7/2025
0.0.1 77 12/30/2024