本文整理汇总了C#中System.Collections.Dictionary.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Reverse方法的具体用法?C# Dictionary.Reverse怎么用?C# Dictionary.Reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Dictionary
的用法示例。
在下文中一共展示了Dictionary.Reverse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItemString
private static string GetItemString(Dictionary<string, string> dic)
{
var rev = dic.Reverse();
var sb = new StringBuilder();
foreach (var item in rev)
{
sb.Append(item.Key + "=" + item.Value + ",");
}
sb.Length--;
return sb.ToString();
}
示例2: GetRequiredResources
public virtual IEnumerable<RequireSettings> GetRequiredResources(string type)
{
List<RequireSettings> result = new List<RequireSettings>();// = _required.Where(r => r.Key.Item1 == type).Select(r => r.Value);
try
{
IDictionary<int, List<RequireSettings>> group = new Dictionary<int, List<RequireSettings>>();
foreach (var item in _required)
{
if (item.Key.Item1 == type)
{
if (!group.ContainsKey(item.Value.Group))
group[item.Value.Group] = new List<RequireSettings>();
group[item.Value.Group].Add(item.Value);
}
}
foreach (var g in group.Reverse())
{
result.AddRange(g.Value);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write(ex.Message);
result = _required.Where(r => r.Key.Item1 == type).Select(r => r.Value).ToList();
}
return result;
}
示例3: CreateAggregateItems
//.........这里部分代码省略.........
if (ft.Width > ((Telerik.Reporting.Processing.TextBox)s).Size.Width.Value)
{
foreach (var f in additionalInfoForLastAggregateItem)
{
((Telerik.Reporting.Processing.ReportItem)s).Location = new PointU(f.Key, ((Telerik.Reporting.Processing.ReportItem)s).Location.Y);
((Telerik.Reporting.Processing.ReportItem)s).Size = new SizeU(Unit.Inch(f.Value + ((Telerik.Reporting.Processing.ReportItem)s).Size.Width.Value), height);
if (((Telerik.Reporting.Processing.ReportItem)s).Size.Width.Value >= ft.Width)
{
break;
}
}
}
};
textbox.ItemDataBound += textboxItemDataBoundHandler;
EventHandler textboxDisposedHandler = null;
textboxDisposedHandler = (sender, args) =>
{
textbox.ItemDataBound -= textboxItemDataBoundHandler;
textbox.Disposed -= textboxDisposedHandler;
};
textbox.Disposed += textboxDisposedHandler;
}
if (AggregateHelper.IsPageAggregateType(criteria.SummaryType))
{
var aggregateFunction = forGroups ? "Exec" : "PageExec";
var aggregateFunctionParameter = forGroups ? ":scope:" : aggregateInfo.Key + "TextBox";
textbox.Value = string.Format(
@"='{0}: ' + AfterCalculateAggregates({7}('{8}', {2}(BeforeCalculateAggregates(Fields.[{1}], ""{2}"", ""{3}"", ""{4}"", ""{5}"", ""{6}""))), ""{2}"", ""{3}"", ""{4}"", ""{5}"", ""{6}"")",
AggregateHelper.GetAttribute(criteria.SummaryType).ShortName,
aggregateInfo.Key,
criteria.SummaryType,
criteria.CustomConverter,
criteria.TargetType,
criteria.TypeName,
criteria.ConverterParameter,
aggregateFunction,
aggregateFunctionParameter);
}
else
{
var result = serverAggregateResults.FirstOrDefault(r => r.ColumnName == criteria.ColumnName && r.SummaryType == criteria.SummaryType);
textbox.Value = string.Format("{0}: {1}", AggregateHelper.GetAttribute(criteria.SummaryType).ShortName, result);
}
list.Add(textbox);
locationY += height;
}
aggregateItems.Add(aggregateInfo.Key, list);
}
}
if (aggregateItems.Count > 1)
{
var lastItem = aggregateItems.Last();
aggregateItems.Remove(lastItem.Key);
var penultimateItem = aggregateItems.Last();
var indexOfPenultimateItem = _colDict.First(x => x.Value[0] == penultimateItem.Key).Key;
var indexOfLastItem = _colDict.First(x => x.Value[0] == lastItem.Key).Key;
if (indexOfLastItem - indexOfPenultimateItem > 1) // if exists at least one column between last and penultimate aggregate columns
{
// fill additional info for last aggrigate item
var i = Convert.ToInt32((indexOfLastItem - indexOfPenultimateItem - 1) / 2);
foreach (var column in _colDict)
{
if (column.Key >= i + indexOfPenultimateItem + 1 && column.Value[0] != lastItem.Key)
{
var item = ((ReportItem)currentReport.Items["detail"].Items["rowPanel"].Items.FirstOrDefault(x => x.Name == string.Format("{0}TextBox", column.Value[0])));
if (item != null)
{
additionalInfoForLastAggregateItem.Add(item.Location.X, item.Size.Width.Value);
}
}
}
var descending = additionalInfoForLastAggregateItem.Reverse();
additionalInfoForLastAggregateItem = descending.ToDictionary(x => x.Key, x => x.Value);
// new size of penultimate item
foreach (var textbox in penultimateItem.Value)
{
textbox.Size = new SizeU(Unit.Inch(textbox.Size.Width.Value / 2), height);
}
}
aggregateItems.Add(lastItem.Key, lastItem.Value);
}
var returnList = new List<TextBox>();
foreach (var aggregateItem in aggregateItems)
{
returnList.AddRange(aggregateItem.Value);
}
return returnList;
}