本文整理汇总了C#中CacheList.SortBy方法的典型用法代码示例。如果您正苦于以下问题:C# CacheList.SortBy方法的具体用法?C# CacheList.SortBy怎么用?C# CacheList.SortBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheList
的用法示例。
在下文中一共展示了CacheList.SortBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCaches
public static Caches GetCaches()
{
Cache _cache = HttpRuntime.Cache;
IDictionaryEnumerator cacheEnum = _cache.GetEnumerator();
CacheList cl = new CacheList();
cl = new CacheList();
while (cacheEnum.MoveNext())
{
cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString()));
}
Caches rs = new Caches();
rs.CacheList = new CacheList();
cl.SortBy(CacheInfo.Columns.Key, true);
rs.CacheList.AddRange(cl);
rs.Total = cl.Count;
return rs;
}
示例2: GetCaches
private static Caches GetCaches(bool isGetAll, int pageIndex, int pageSize, string sort, bool isAsc, string cacheKey, string cacheType)
{
Cache _cache = HttpRuntime.Cache;
IDictionaryEnumerator cacheEnum = _cache.GetEnumerator();
CacheList cl = new CacheList();
cl = new CacheList();
while (cacheEnum.MoveNext())
{
if (!string.IsNullOrEmpty(cacheKey) && cacheEnum.Key.ToString().ToUpper().IndexOf(cacheKey.ToUpper()) < 0) continue;
if (!string.IsNullOrEmpty(cacheType) && cacheEnum.Value.GetType().ToString().ToUpper().IndexOf(cacheType.ToUpper()) < 0) continue;
cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString()));
}
Caches rs = new Caches();
rs.CacheList = new CacheList();
if (isGetAll)
{
cl.SortBy(sort, isAsc);
rs.CacheList.AddRange(cl);
}
else
rs.CacheList.AddRange(cl.GetPaging(pageSize, pageIndex, sort, isAsc));
rs.Total = cl.Count;
return rs;
}