Table of Contents

Class StatisticalRegionInfo

Namespace
Cuemon.Globalization
Assembly
Cuemon.Core.dll

Represents a geographic region or country as defined by the UN M.49 standard.

public sealed class StatisticalRegionInfo
Inheritance
StatisticalRegionInfo

Examples

The following example demonstrates how to use via the class to retrieve UN M.49 region data.

using System;
using System.Linq;
using Cuemon.Globalization;

namespace MyApp.Examples;

public class StatisticalRegionInfoExample
{
    public void Demonstrate()
    {
        // Get United States by its UN M.49 code
        StatisticalRegionInfo usa = World.GetCountry("840");

        if (usa != null)
        {
            Console.WriteLine($"Name: {usa.Name}");
            Console.WriteLine($"Code: {usa.Code}");
            Console.WriteLine($"ISO Alpha-2: {usa.IsoAlpha2}");
            Console.WriteLine($"ISO Alpha-3: {usa.IsoAlpha3}");
            Console.WriteLine($"Kind: {usa.Kind}");
            Console.WriteLine($"Parent: {usa.Parent?.Name}");

        // List all European countries
        var europe = World.GetStatisticalRegion("150");
        if (europe != null)
        {
            Console.WriteLine($"\nCountries in {europe.Name}:");
            foreach (var country in europe.Countries.Take(5))
            {
                Console.WriteLine($" - {country.Name} ({country.IsoAlpha2})");

}}}}
}

Remarks

UN M.49 is a standard for representing country and area codes for statistical use. This class provides a unified view of the hierarchy, treating countries as leaf nodes in the region tree. Each instance has a Kind that identifies its level in the hierarchy (World, Region, Subregion, IntermediateRegion, or CountryOrTerritory). Source: https://unstats.un.org/unsd/methodology/m49/

Properties

Children

Gets the direct child regions or countries of this region.

public IEnumerable<StatisticalRegionInfo> Children { get; }

Property Value

IEnumerable<StatisticalRegionInfo>

An enumerable list of children. Empty list if this is a leaf node (country).

Code

Gets the UN M.49 numeric code for this region or country.

public string Code { get; }

Property Value

string

The three-digit UN M.49 code (e.g., "001" for World, "840" for United States).

Countries

Gets all countries in this geographic region.

public IEnumerable<StatisticalRegionInfo> Countries { get; }

Property Value

IEnumerable<StatisticalRegionInfo>

An enumerable list of child regions where Kind is CountryOrTerritory.

Remarks

This is a convenience property that filters Children to return only countries. It recursively includes all descendant countries, not just immediate children.

IsLandLockedDevelopingCountry

Gets a value indicating whether this country is classified as a Land Locked Developing Country (LLDC).

public bool IsLandLockedDevelopingCountry { get; }

Property Value

bool

true if this is an LLDC; otherwise, false. Always false for non-countries.

IsLeastDevelopedCountry

Gets a value indicating whether this country is classified as a Least Developed Country (LDC).

public bool IsLeastDevelopedCountry { get; }

Property Value

bool

true if this is an LDC; otherwise, false. Always false for non-countries.

IsSmallIslandDevelopingState

Gets a value indicating whether this country is classified as a Small Island Developing State (SIDS).

public bool IsSmallIslandDevelopingState { get; }

Property Value

bool

true if this is a SIDS; otherwise, false. Always false for non-countries.

IsoAlpha2

Gets the ISO 3166-1 alpha-2 code for this country.

public string IsoAlpha2 { get; }

Property Value

string

The two-letter ISO code (e.g., "US", "DE"), or null if this is not a country.

IsoAlpha3

Gets the ISO 3166-1 alpha-3 code for this country.

public string IsoAlpha3 { get; }

Property Value

string

The three-letter ISO code (e.g., "USA", "DEU"), or null if this is not a country.

Kind

Gets the kind of this statistical region.

public StatisticalRegionKind Kind { get; }

Property Value

StatisticalRegionKind

A StatisticalRegionKind value indicating the hierarchy level.

Name

Gets the official UN name of this region or country.

public string Name { get; }

Property Value

string

The name (e.g., "World", "Europe", "United States of America").

Parent

Gets the parent region in the UN M.49 hierarchy.

public StatisticalRegionInfo Parent { get; }

Property Value

StatisticalRegionInfo

The parent region, or null if this is the World region (code "001").

Region

Gets the .NET RegionInfo for this country if available.

public RegionInfo Region { get; }

Property Value

RegionInfo

The RegionInfo instance, or null if not a country or not supported by the OS.

Remarks

Some territories (e.g., "British Indian Ocean Territory") may not have OS-level support.

Methods

GetAllDescendants()

Gets all descendant regions and countries recursively.

public IEnumerable<StatisticalRegionInfo> GetAllDescendants()

Returns

IEnumerable<StatisticalRegionInfo>

An enumerable of all descendants in the hierarchy.

GetAncestors()

Gets all ancestor regions in the hierarchy up to and including World.

public IEnumerable<StatisticalRegionInfo> GetAncestors()

Returns

IEnumerable<StatisticalRegionInfo>

An enumerable of ancestor regions, ordered from immediate parent to World.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.