当前位置: 首页>>代码示例>>C#>>正文


C# Dictionary.Aggregate方法代码示例

本文整理汇总了C#中System.Collections.Dictionary.Aggregate方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Aggregate方法的具体用法?C# Dictionary.Aggregate怎么用?C# Dictionary.Aggregate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Dictionary的用法示例。


在下文中一共展示了Dictionary.Aggregate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HtmlElement

 /// <summary>
 /// Builds the element with a list of attributes
 /// </summary>
 /// <param name="el">The element</param>
 /// <param name="attributes">A dictionary of attributes to add to the element</param>
 public HtmlElement(String el, Dictionary<String, String> attributes )
 {
     var attrs = attributes.Aggregate("", (current, item) => current + (item.Key + "='" + item.Value + "' " ));
     this.elementStart = "<" + el + " " + attrs + ">";
     this.elementEnd = "</" + el + ">";
     this.el = el;
 }
开发者ID:plachmann,项目名称:crds-angular,代码行数:12,代码来源:HtmlElement.cs

示例2: DetermineDataType

 /// <summary>
 /// Returns the type that is used most often in a range of cells.
 /// </summary>
 /// <returns>The predominant <c>Type</c> in the range of cells.</returns>
 public static Type DetermineDataType(Range excelCells)
 {
     IDictionary<Type, int> typeCounts = new Dictionary<Type, int> ();
                 foreach (Range cell in excelCells) {
                         if (cell.Value == null) {
                                 logger.Info ("A null value was encoutered in Cell: {0}{1}",
               cell.Row,
               cell.Column);
                         } else {
                                 Type cellType = cell.Value.GetType ();
                                 if (typeCounts.ContainsKey (cellType)) {
                                         typeCounts [cellType] += 1;
                                 } else {
                                         typeCounts.Add (cellType, 1);
                                 }
                         }
                 }
                 if (typeCounts.Count == 0)
                         throw new ArgumentException ("All cells were empty. Can not proceed");
                 Type maxUsedType = typeCounts.Aggregate ((l, r) => l.Value > r.Value ? l : r).Key;
                 return maxUsedType;
 }
开发者ID:bergmannf,项目名称:OposParser,代码行数:26,代码来源:ExcelDatasource.cs

示例3: GetRelativeOrientation2

        private RelativeOrientation GetRelativeOrientation2(IPolycurve pFoundLineAsPolyCurve, IPolycurve inPolycurve)
        {
            //iRelativeOrientation == 1 --> closest points are original TO and found TO
            //iRelativeOrientation == 2 --> closest points are original TO and found FROM
            //iRelativeOrientation == 3 --> closest points are original FROM and found TO
            //iRelativeOrientation == 4 --> closest points are original FROM and found FROM
            
            Dictionary<int, double> dictSort2GetShortest = new Dictionary<int, double>();
            dictSort2GetShortest.Add(1, ((IProximityOperator)pFoundLineAsPolyCurve.ToPoint).ReturnDistance(inPolycurve.ToPoint));
            dictSort2GetShortest.Add(2, ((IProximityOperator)pFoundLineAsPolyCurve.FromPoint).ReturnDistance(inPolycurve.ToPoint));
            dictSort2GetShortest.Add(3, ((IProximityOperator)pFoundLineAsPolyCurve.ToPoint).ReturnDistance(inPolycurve.FromPoint));
            dictSort2GetShortest.Add(4, ((IProximityOperator)pFoundLineAsPolyCurve.FromPoint).ReturnDistance(inPolycurve.FromPoint));

            return (RelativeOrientation)dictSort2GetShortest.Aggregate((l, r) => l.Value < r.Value ? l : r).Key;
        }
开发者ID:travisval,项目名称:ParcelFabricCurveByInference,代码行数:15,代码来源:CurveByInference.cs

示例4: PrintDictionary

 public static void PrintDictionary(Dictionary<string, string> dict)
 {
     var pS = dict.Aggregate("\n",
         (current, variable) => current + (variable.Key + "=" + variable.Value + "\n"));
     Log.Debug(pS);
 }
开发者ID:bperreault,项目名称:autox,代码行数:6,代码来源:Utilities.cs


注:本文中的System.Collections.Dictionary.Aggregate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。