AirlineCollection 1.2.0

Install-Package AirlineCollection -Version 1.2.0
dotnet add package AirlineCollection --version 1.2.0
<PackageReference Include="AirlineCollection" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AirlineCollection --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AirlineCollection, 1.2.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install AirlineCollection as a Cake Addin
#addin nuget:?package=AirlineCollection&version=1.2.0

// Install AirlineCollection as a Cake Tool
#tool nuget:?package=AirlineCollection&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
  • Light-weight
  • Device-agnostic country data (Alternative to the .NET Framework RegionInfo data)
  • Preloaded airline information wtih IATA 2-digit code, ICAO 3-digit code, and names.
  • Airline code lookup and normalization
  • Convenient static data collection with methods
  • Fully customizable instance data collection (to add new data and to remove old data)
  • IEnumerable implementation (can be used with LINQ)
  • DI-friendly interface
  • Unit Tested
  • No external library dependencies
  • No external calls
Name Format Description Example Notes
Iata2LetterCode Alphanumeric(2) IATA 2-Letter Code "AA" Commonly used for flight numbers; Can be recycled from a defunct airline
Icao3LetterCode Alphanumeric(3) ICAO 3-Letter Code "AAL" Occasionally used for flight numbers
Prefix Numeric(3) IATA-assigned air waybill prefix "001"
IataName (string) Name registered at IATA "American Airlines Inc." Not recommended for general use
IcaoName (string) Name registered at ICAO "American Airlines" Not recommended for general use
CallSign alphanumeric Identification of an aircraft in air-ground communications "American"
Name (string) General name "American Airlines" The most commonly used name

STATIC MEMBERS

Read-only data collection

.Contains(code)

string code = "AA";
bool valid = AirlineCollection.Contains(code);  // True

.Contains(code)

string lowerCased = "aa";
bool valid = AirlineCollection.Contains(lowerCased);  // True

.Contains(code)

int numericCode = 1;
bool valid = AirlineCollection.Contains(numericCode);  // True

.Normalize(code)

string iata2DigitCode = "aa";
string code = AirlineCollection.Normalize(iata2DigitCode);  // "AA"

.Normalize(code)

string icao3DigitCode = "aal";
string code = AirlineCollection.Normalize(icao3DigitCode);  // "AAL"

.Normalize(code)

int numericCode = 1;
string code = AirlineCollection.Normalize(numericCode);  // "001"

.Normalize(code)

string invalidCode = "xyz";
string code = AirlineCollection.Normalize(invalidCode);  // null

.Normalize(code)

int numericCode = 99999;
string code = AirlineCollection.Normalize(numericCode);  // null

.GetAirline(code)

string code = "AA";
var country = AirlineCollection.GetAirline(code);  // { "Iata2LetterCode":"AA", "Icao3LetterCode":"USA", "Prefix":"001", "IataName":"American Airlines Inc.", "IcaoName":"American Airlines", "Callsign":"American Airlines", "Name":"American Airlines" }

.GetCountry(code)

string invalidCode = "XYZ";
var airline = CountryCollection.GetAirline(code);  // null

<br />

INSTANCE MEMBERS

Customizable data collection (All instance members can be mocked in unit testing by implementing IAirlineCollection)

[code]

string code = "AA";
var airline = new AirlineCollection()[code];  // { "Iata2LetterCode":"AA", "Icao3LetterCode":"USA", "Prefix":"001", "IataName":"American Airlines Inc.", "IcaoName":"American Airlines", "Callsign":"American Airlines", "Name":"American Airlines" }

.Add(iata2LetterCode, icao3LetterCode, prefix)

.Add(iata2LetterCode, icao3LetterCode, prefix, iataName, icaoName, callSign, name)

var airlines = new AirlineCollection();
airlines.Add("XX", "XXX", "999");
airlines.Add("ZZ", "ZZZ", "000", "ZZ Airline", "ZZ Air LLC", "ZZA", "ZZ Air");

.Remove(code)

var code = "AA";
var airlines = new AirlineCollection();
airlines.Remove(code);

<br />

EXTENSION METHODS

.Contains(code)

string code = "AA";
bool valid = new AirlineCollection().Contains(code);  // extension method

.Normalize(code)

string iata2DigitCode = "aa";
string code = new AirlineCollection().Normalize(iata2DigitCode);  // extension method

.GetAirline(code)

string code = "AA";
var country = AirlineCollection.GetAirline(code);  // extension method
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.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.2.0 73 12/5/2021
1.1.0 53 12/2/2021
1.0.0 3,268 11/25/2021

* Added more confirmed airlines
* Passed all unit tests (unchanged)