54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Reflection;
|
|
|
|
namespace Zhaizj.Framework.Common.Resource {
|
|
|
|
/// <summary>
|
|
/// 属性数据列表,常用于下拉列表中
|
|
/// </summary>
|
|
public class PropertyCollection : CollectionBase {
|
|
public int Add( PropertyItem item ) {
|
|
return List.Add( item );
|
|
}
|
|
|
|
public Boolean Contains( PropertyItem item ) {
|
|
return List.Contains( item );
|
|
}
|
|
|
|
public PropertyItem FindByValue( int val ) {
|
|
foreach (PropertyItem item in List) {
|
|
if (item.Value == val) {
|
|
return item;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public String GetName( int val ) {
|
|
PropertyItem item = FindByValue( val );
|
|
if (item == null) return "";
|
|
if (AppResource.IsSelectTip( item.Name )) return "";
|
|
return item.Name;
|
|
}
|
|
|
|
public int IndexOf( PropertyItem item ) {
|
|
return List.IndexOf( item );
|
|
}
|
|
|
|
public void Insert( int index, PropertyItem item ) {
|
|
List.Insert( index, item );
|
|
}
|
|
|
|
public void Remove( PropertyItem item ) {
|
|
List.Remove( item );
|
|
}
|
|
|
|
public PropertyItem this[int index] {
|
|
get { return (PropertyItem)List[index]; }
|
|
set { List[index] = value; }
|
|
}
|
|
}
|
|
}
|
|
|