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


C# LinkedList.Min方法代码示例

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


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

示例1: IsStabilized

 static Func<Point, bool> IsStabilized()
 {
     const int maxVariance = 50;
     var last10 = new LinkedList<Point>(new Point(0, 0).Repeat(50));
     return currentPosition =>
     {
         last10.RemoveLast();
         last10.AddFirst(currentPosition);
         var xVariance = last10.Max(p => p.X) - last10.Min(p => p.X);
         var yVariance = last10.Max(p => p.Y) - last10.Min(p => p.Y);
         return xVariance < maxVariance && yVariance < maxVariance;
     };
 }
开发者ID:mlidbom,项目名称:tobii,代码行数:13,代码来源:030-ReactiveExtensions.cs

示例2: IsStabilized

 static Func<Zipping.Pair<int, int>, bool> IsStabilized()
 {
     const int maxVariance = 50;
     var last10 = new LinkedList<Zipping.Pair<int, int>>(new Zipping.Pair<int, int>(0, 0).Repeat(10));
     return currentPosition =>
     {
         last10.RemoveLast();
         last10.AddFirst(currentPosition);
         var xVariance = last10.Max(p => p.First) - last10.Min(p => p.First);
         var yVariance = last10.Max(p => p.Second) - last10.Min(p => p.Second);
         return xVariance < maxVariance && yVariance < maxVariance;
     };
 }
开发者ID:mlidbom,项目名称:tobii,代码行数:13,代码来源:020_StreamProcessing.cs

示例3: Main

    static void Main()
    {
        var list = new LinkedList<int>();

        list.AddLast(1);
        Console.WriteLine(list);

        list.AddLast(2);
        Console.WriteLine(list);

        list.AddLast(3);
        Console.WriteLine(list);

        list.AddFirst(-1);
        Console.WriteLine(list);

        list.AddFirst(-2);
        Console.WriteLine(list);

        list.AddFirst(-3);
        Console.WriteLine(list);

        Console.WriteLine("Remove First: {0}", list.RemoveFirst().Value);
        Console.WriteLine("Remove Last: {0}", list.RemoveLast().Value);
        Console.WriteLine(list);

        Console.WriteLine("Min: {0}; Max: {1}", list.Min(), list.Max());
        Console.WriteLine("Contains 2: {0}", list.Contains(2));
        Console.WriteLine("Count: {0}", list.Count);
    }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:30,代码来源:Program.cs

示例4: SearchProperties


//.........这里部分代码省略.........
                    splitPrice = formCollection["PriceRange"].Split('-');
                }

                LinkedList<decimal> thePrices = new LinkedList<decimal>();



                foreach (var thePrice in splitPrice)
                {
                    int TryParseResult = 0;
                    //try parse to check it's a number
                    Int32.TryParse(thePrice.Trim().Replace("£", "").Replace("$", "").ToString(), out TryParseResult);


                    var cash = (decimal)TryParseResult;
                    if (TryParseResult != 0)
                    {
                        //IF SYSTEM IS US DOLLARS, NEED TO CONVERT THE NUMBER INTO POUNDS
                        if ((string)ConfigurationManager.AppSettings["defaultCurrency"] != "GBP")
                        {
                           var cc = new CurrencyConverterController();
                            cash = cc.ConvertCurrency((string)ConfigurationManager.AppSettings["defaultCurrency"], "GBP", (decimal)cash);
                        }
                            thePrices.AddLast(cash);
                    }
                }
                //end parse price range


                PriceRange customerQueryPriceRange = null;

                if (thePrices.Count > 0)
                {
                    customerQueryPriceRange = new PriceRange(thePrices.Min(), thePrices.Max());
                }
                else //pass the max range ever
                {
                    customerQueryPriceRange = new PriceRange(0, 100000);
                }

                //END FORM PARSE

                //Now test if there are dates - if yes - create a booking query. If no, create a property query


                //create property query
                PropertySearch newSearch = new PropertySearch()
                {
                    MaxSleeps = maxSleeps,
                    NoOfAdults = noOfAdults,
                    NoOfChildren = noOfChildren,
                    NoOfInfants = noOfInfants,
                    PoolType = poolType,
                    PropertyTypeID = propertyTypeID,
                    TheSearchPriceRange = customerQueryPriceRange,
                    VacationTypeID = vacationTypeID
                };

                //do the search

                var searchResults = newSearch.SearchForMatchingProperties();
                //if there are dates, pass the search results into the BookingSearch

                if (startDate.HasValue && endDate.HasValue)
                {
                    //create booking query                                                                        
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:67,代码来源:HomeController.cs

示例5: LinkedListExtensions_Min_ThrowsExceptionIfLinkedListIsEmpty

        public void LinkedListExtensions_Min_ThrowsExceptionIfLinkedListIsEmpty()
        {
            var list = new LinkedList<Int32>();

            list.Min();
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:6,代码来源:LinkedListExtensionsTest.cs

示例6: LinkedListExtensions_Min_ReturnsMinValue

        public void LinkedListExtensions_Min_ReturnsMinValue()
        {
            var list = new LinkedList<Int32>();
            list.AddLast(4);
            list.AddLast(5);
            list.AddLast(6);
            list.AddLast(99);
            list.AddLast(10);
            list.AddLast(1);
            list.AddLast(12);
            list.AddLast(45);

            var result = list.Min();

            TheResultingValue(result).ShouldBe(1);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:16,代码来源:LinkedListExtensionsTest.cs

示例7: LinkedListExtensions_Min_ThrowsExceptionIfLinkedListIsEmpty

        public void LinkedListExtensions_Min_ThrowsExceptionIfLinkedListIsEmpty()
        {
            var list = new LinkedList<Int32>();

            Assert.That(() => list.Min(),
                Throws.TypeOf<InvalidOperationException>());
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:7,代码来源:LinkedListExtensionsTest.cs

示例8: SearchProperties

        public ActionResult SearchProperties(FormCollection formCollection, int page = 1)
        {
            //retrive values from post
            //based on whether there are dates create either a booking search or property search
            //create new object and populate - then run dynamic instance query on that object

            int propertyTypeID = 0;
            int vacationTypeID = 0;
            string poolType = null;
            int maxSleeps = 0;
            int noOfAdults = 0;
            int noOfChildren = 0;
            int noOfInfants = 0;

            DateTime? startDate = null;
            DateTime? endDate = null; ;

            try
            {
                //parse dates
                if (formCollection["bookingModalStartDatePicker"] != "" && formCollection["bookingModalStartDatePicker"] != null)
                {
                    startDate = DateTime.Parse(formCollection["bookingModalStartDatePicker"]);
                }
                if (formCollection["EndDate"] != "" && formCollection["EndDate"] != null)
                {
                    endDate = DateTime.Parse(formCollection["EndDate"]);
                }
                //parse property Type ID
                if (Int32.Parse(formCollection["PropertyType"]) != 0)
                {
                    propertyTypeID = Int32.Parse(formCollection["PropertyType"]);
                }
                //parse region type
                if (Int32.Parse(formCollection["RegionType"]) != 0)
                {
                    vacationTypeID = Int32.Parse(formCollection["RegionType"]);
                }
                //parse poolType
                if (formCollection["PoolType"] != "" && formCollection["PoolType"] != null && poolType != "0")
                {
                    poolType = formCollection["PoolType"];
                }
                //parse max sleeps
                if (Int32.Parse(formCollection["MaxSleeps"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["MaxSleeps"]);
                }
                //parse no of adults
                if (Int32.Parse(formCollection["NoOfAdults"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["NoOfAdults"]);
                }
                //parse no of children
                if (Int32.Parse(formCollection["NoOfChildren"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["NoOfChildren"]);
                }
                //parse no of infants
                if (Int32.Parse(formCollection["NoOfInfants"]) != 0)
                {
                    maxSleeps = Int32.Parse(formCollection["NoOfInfants"]);
                }
                //parse price range
                 String[] splitPrice = "1-1000".Split('-');

                if (formCollection["PriceRange"] != "" && formCollection["PriceRange"] != null)
                {
                    splitPrice = null;
                    splitPrice = formCollection["PriceRange"].Split('-');
                }

                LinkedList<decimal> thePrices = new LinkedList<decimal>();

                foreach (var thePrice in splitPrice)
                {
                    int TryParseResult = 0;
                    //try parse to check it's a number
                    Int32.TryParse(thePrice.Trim().Replace("£", "").ToString(), out TryParseResult);

                    if (TryParseResult != 0)
                    {
                    thePrices.AddLast(Decimal.Parse(thePrice.Trim().Replace("£", "")));
                    }
                }
                //end parse price range

                PriceRange customerQueryPriceRange = null;

                if (thePrices.Count > 0)
                {
                    customerQueryPriceRange = new PriceRange(thePrices.Min(), thePrices.Max());
                }
                else //pass the max range ever
                {
                    customerQueryPriceRange = new PriceRange(0, 100000);
                }

                //END FORM PARSE

//.........这里部分代码省略.........
开发者ID:nadavdrewe,项目名称:portugalvillas,代码行数:101,代码来源:HomeController.cs


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