日期:2014-05-18  浏览次数:21335 次

C# 如何实现对Attribute实现本地化语言
C# code

        [CategoryAttribute("特性")]
        public virtual double 圆心X坐标
        {
            get
            {
                return Owner.Center.x;
            }
            set
            {
                Owner.Center = new UnitPoint(value, Owner.Center.y);
            }
        }


我现在要将CategoryAttribute的"特性"翻译成不同语言版本的,不知道如何实现

------解决方案--------------------
"特性"取自资源文件,你做好不同语言的资源文件
[CategoryAttribute(Properties.Resources.value)]
------解决方案--------------------
自己继承CategoryAttribute,然后重写GetLocalizedString方法或者Category属性
------解决方案--------------------
那还是重写 GetLocalizedString 吧,这里面试绝对可以用资源文件的
------解决方案--------------------
探讨

引用:
自己继承CategoryAttribute,然后重写GetLocalizedString方法或者Category属性

这个要写的太多了