枚举类型本地化操作的简单方案,并应用到Asp.net MVC的DropdownList中。 
\
/// <summary>
    /// Enum Localizable. default resouce key={Prefix}_{Enum}
    /// If you ignore Prefix,will return {EnumTypeName}_{Enum} format
    /// </summary>
[AttributeUsage(AttributeTargets.Enum, AllowMultiple = true, Inherited = true)]
    public class LocalizableAttribute : Attribute
    {
        public LocalizableAttribute(Type language)
        {
            this.LanguageType = language;
        }
        public LocalizableAttribute(Type language, String prefix)
            :this(language)
        {
            Prefix = prefix;
        }

        public Type LanguageType
        {
            get;
            set;
        }
        public string Prefix
        {
            get;
            set;
        }
    }
    public static class EnumerableExtension
    {
public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
        {
            foreach (T item in enumerable)
            {
                action(item);
            }
        }

        public static string ToLocalizable(this Enum value)
        {
            LocalizableAttribute customAttr=(LocalizableAttribute) Attribute
.GetCustomAttribute(value.GetType(), typeof(LocalizableAttribute));
            ResourceManager _resources = new ResourceManager(customAttr.
LanguageType);
            var prefix=customAttr.Prefix;
            if (string.IsNullOrEmpty(prefix))
           &nbs
补充:软件开发 , C# ,