赞
踩
按MyClass的Name字段排序
- public class EntityObjectMuster : ObservableCollection<MyClass>
- {
- /// <summary>
- /// 实现排序插入
- /// </summary>
- /// <param name="baseSemObjects"></param>
- public void AttachItem(MyClass entityObject)
- {
- if (this.Count == 0)
- {
- Add(entityObject);
- }
- else
- {
- bool isInsret = false;
- for (int i = 0; i < this.Count; i++)
- {
- if (String.Compare(this[i].Name, entityObject.Name, false) >= 0)
- {
- InsertItem(i, entityObject);
- isInsret = true;
- break;
- }
- }
- if (!isInsret)
- {
- Add(entityObject);
- }
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。