aurora/aurora-shared/Cursor/CursorList.cs

32 lines
626 B
C#
Raw Normal View History

2021-03-05 16:56:51 +00:00
using System.Collections.Generic;
using System.Collections;
using System;
using System.Linq;
using Aurora.Utils;
namespace Aurora.Cursor
{
public class CursorList<T> : SortedList<string, T> where T : ICursorObject
{
public CursorList()
{
}
public CursorList<T> Add(T item)
{
2021-03-06 00:09:42 +00:00
string id = item.Id;
if (item.Id == null)
{
id = HashUtil.GetHash(new string[] { item.GetHashCode().ToString() }).ToString();
item.Id = id;
}
this.Add(id, item);
2021-03-05 16:56:51 +00:00
return this;
}
}
}