File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,21 @@ public T Get(string id)
3333 return value ;
3434 }
3535
36+ public bool TryGet ( int id , out T value )
37+ {
38+ return LongDataMaps . TryGetValue ( id , out value ) ;
39+ }
40+
41+ public bool TryGet ( long id , out T value )
42+ {
43+ return LongDataMaps . TryGetValue ( id , out value ) ;
44+ }
45+
46+ public bool TryGet ( string id , out T value )
47+ {
48+ return StringDataMaps . TryGetValue ( id , out value ) ;
49+ }
50+
3651 public T this [ int index ]
3752 {
3853 get
Original file line number Diff line number Diff line change @@ -48,6 +48,30 @@ public interface IDataTable<T> : IDataTable where T : class
4848 /// <returns></returns>
4949 T Get ( string id ) ;
5050
51+ /// <summary>
52+ /// 尝试根据整数ID获取对象
53+ /// </summary>
54+ /// <param name="id">要获取的对象的整数ID</param>
55+ /// <param name="value">当找到对应ID的对象时,返回该对象;否则返回默认值</param>
56+ /// <returns>如果找到对应ID的对象则返回true,否则返回false</returns>
57+ bool TryGet ( int id , out T value ) ;
58+
59+ /// <summary>
60+ /// 尝试根据长整数ID获取对象
61+ /// </summary>
62+ /// <param name="id">要获取的对象的长整数ID</param>
63+ /// <param name="value">当找到对应ID的对象时,返回该对象;否则返回默认值</param>
64+ /// <returns>如果找到对应ID的对象则返回true,否则返回false</returns>
65+ bool TryGet ( long id , out T value ) ;
66+
67+ /// <summary>
68+ /// 尝试根据字符串ID获取对象
69+ /// </summary>
70+ /// <param name="id">要获取的对象的字符串ID</param>
71+ /// <param name="value">当找到对应ID的对象时,返回该对象;否则返回默认值</param>
72+ /// <returns>如果找到对应ID的对象则返回true,否则返回false</returns>
73+ bool TryGet ( string id , out T value ) ;
74+
5175 /// <summary>
5276 /// 根据列表索引获取对象
5377 /// </summary>
You can’t perform that action at this time.
0 commit comments