Skip to content

The .NET Core implementation for looking up Chinese administrative divisions.

License

Notifications You must be signed in to change notification settings

codeyu/gb2260.cs

Repository files navigation

GB2260.cs

The .NET Core implementation for looking up Chinese administrative divisions.

GB/T 2260

GB/T 2260 Build Status Build status Coverage Status NuGet Badge Software License

The latest GB/T 2260 codes. Read the GB2260 Specification.

Build

Install with nuget:

Install-Package GB2260.Core

Usage

GB2260

GB2260 gb = Gb2260Factory.Create(); // with default revision 201607
GB2260 gb = Gb2260Factory.Create(Revision.V201607); // specify the revision

Interface for GB2260.

.GetDivision(code)

Get division for the given code.

Division division = gb.GetDivision("110105")
// 北京市 市辖区 朝阳区

division.Name
// 朝阳区
division.Code
// 110105
(int)division.Revision
// 201607

division.GetProvince()
// 北京市
division.GetPrefecture()
// 市辖区

division.ToString()
// 北京市 市辖区 朝阳区

.GetProvinces()

Return a list of provinces in Division data structure.

gb.GetProvinces()

.GetPrefectures(code)

Return a list of prefecture level cities in Division data structure.

gb.GetPrefectures("110000")

.GetCounties(code)

Return a list of counties in Division data structure.

gb.GetCounties("110100")

class Revision

Revision contains a list of available revisions.

(int)Revision.V201607 // return 201607

License

MIT.

About

The .NET Core implementation for looking up Chinese administrative divisions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published