System.Attribute排除重复值

时间:2014-03-04 06:08:00

标签: c# .net web-config custom-attributes

我有一个list属性,它使用System.Attribute类进行修饰。是否可以在列表的属性级别包含检查以仅包含不同的值?

[ConfigSettingList(typeof(string),Description="Contains a list of supported handheld devices . Default is the below list .")]
        public List<string> HandHeldDevices
        {
            get
            {
                if (_handHeldDevices == null)
                {
                    _handHeldDevices = new List<string> { "Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "IEMobile", "Opera Mini" };
                }
                return _handHeldDevices;
            }
        }
        private List<string> _handHeldDevices;

ConfigSettingList继承自System.Attribute。我想检查不同的值。

1 个答案:

答案 0 :(得分:0)

使用不允许重复元素的HashSet<T>