+ UICollections:增加俩个函数
This commit is contained in:
parent
e281846a3e
commit
aadacc2992
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
@ -46,6 +46,7 @@ namespace Sunny.UI
|
|||||||
Version = UIGlobal.Version;
|
Version = UIGlobal.Version;
|
||||||
base.Font = UIFontColor.Font;
|
base.Font = UIFontColor.Font;
|
||||||
Size = new Size(100, 35);
|
Size = new Size(100, 35);
|
||||||
|
base.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -56,6 +56,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
Version = UIGlobal.Version;
|
Version = UIGlobal.Version;
|
||||||
base.Font = UIFontColor.Font;
|
base.Font = UIFontColor.Font;
|
||||||
|
base.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
@ -30,6 +31,80 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class CollectionsEx
|
public static class CollectionsEx
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 键排序列表
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="Key">键</typeparam>
|
||||||
|
/// <typeparam name="Value">值</typeparam>
|
||||||
|
/// <param name="dictionary">字典</param>
|
||||||
|
/// <returns>键排序列表</returns>
|
||||||
|
public static List<Key> SortedKeys<Key, Value>(this ConcurrentDictionary<Key, Value> dictionary)
|
||||||
|
{
|
||||||
|
if (dictionary == null) return null;
|
||||||
|
|
||||||
|
List<Key> keys = dictionary.Keys.ToList();
|
||||||
|
keys.Sort();
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 键排序列表
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="Key">键</typeparam>
|
||||||
|
/// <typeparam name="Value">值</typeparam>
|
||||||
|
/// <param name="dictionary">字典</param>
|
||||||
|
/// <returns>键排序列表</returns>
|
||||||
|
public static List<Key> SortedKeys<Key, Value>(this Dictionary<Key, Value> dictionary)
|
||||||
|
{
|
||||||
|
if (dictionary == null) return null;
|
||||||
|
|
||||||
|
List<Key> keys = dictionary.Keys.ToList();
|
||||||
|
keys.Sort();
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 键排序后,取值排序列表
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="Key">键</typeparam>
|
||||||
|
/// <typeparam name="Value">值</typeparam>
|
||||||
|
/// <param name="dictionary">字典</param>
|
||||||
|
/// <returns>值排序列表</returns>
|
||||||
|
public static List<Value> SortedValues<Key, Value>(this ConcurrentDictionary<Key, Value> dictionary)
|
||||||
|
{
|
||||||
|
if (dictionary == null) return null;
|
||||||
|
|
||||||
|
List<Key> keys = dictionary.SortedKeys();
|
||||||
|
List<Value> values = new List<Value>();
|
||||||
|
foreach (var key in keys)
|
||||||
|
{
|
||||||
|
values.Add(dictionary[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 键排序后,取值排序列表
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="Key">键</typeparam>
|
||||||
|
/// <typeparam name="Value">值</typeparam>
|
||||||
|
/// <param name="dictionary">字典</param>
|
||||||
|
/// <returns>值排序列表</returns>
|
||||||
|
public static List<Value> SortedValues<Key, Value>(this Dictionary<Key, Value> dictionary)
|
||||||
|
{
|
||||||
|
if (dictionary == null) return null;
|
||||||
|
|
||||||
|
List<Key> keys = dictionary.SortedKeys();
|
||||||
|
List<Value> values = new List<Value>();
|
||||||
|
foreach (var key in keys)
|
||||||
|
{
|
||||||
|
values.Add(dictionary[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清除
|
/// 清除
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user