using System.Collections.Generic;
namespace HelloWorldMvcApp
public enum TaipeiDistrict : byte
public static IEnumerable<T> GetUnderlyingEnums<T>()
return Enum.GetValues(typeof(T)).Cast<T>();
public static class TaipeiDistrictExtensions
public static string GetChineseName(this TaipeiDistrict st)
var typ = typeof(TaipeiDistrict);
var property = typ.GetField(st.ToString());
var attr = (ChineseName[])property.GetCustomAttributes(typeof(ChineseName), false);
#region Custom attributes
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
public class ChineseName : Attribute
public string Name { get; set; }
public ChineseName(string name)
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
public class EnglishName : Attribute
public string Name { get; set; }
public EnglishName(string name)