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


C# List.Select方法代码示例

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


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

示例1: GetRecommendations

        public static List<Movie> GetRecommendations(List<Movie> all, Dictionary<int, int> newRanks, List<Tuple<int, int, float>> oldRanks)
        {
            int newUserId = 0;
            Ratings ratings = new Ratings();

            foreach (var r in oldRanks)
            {
                ratings.Add(r.Item1, r.Item2, r.Item3);
                if (r.Item1 > newUserId) newUserId = r.Item1;
            }

            // this makes us sure that the new user has a unique id (bigger than all other)
            newUserId = newUserId + 1;

            foreach (var k in newRanks)
            {
                ratings.Add(newUserId, k.Key, (float)k.Value);
            }

            var engine = new BiPolarSlopeOne();

            // different algorithm:
            // var engine = new UserItemBaseline();

            engine.Ratings = ratings;

            engine.Train(); // warning: this could take some time!

            return all.Select(m =>
                                {
                                    m.Rank = engine.Predict(newUserId, m.Id); // do the prediction!
                                    return m;
                                }).ToList();
        }
开发者ID:jitsolutions,项目名称:dotnet-recommend,代码行数:34,代码来源:Engine.cs

示例2: GetDoctorByIds

 public List<md_docter> GetDoctorByIds(List<string> ids)
 {
     string id = string.Join(",", ids.Select(t => t));
     string sql = @"SELECT *
                     FROM md_docter
                     where FIND_IN_SET(pkid,@ids)";
     List<md_docter> resultlist = sqlHelper.ExecuteObjects<md_docter>(sql, new MySqlParameter("ids", id));
     return resultlist;
 }
开发者ID:lehprject,项目名称:sfjyDMS,代码行数:9,代码来源:md_docter_DA.cs

示例3: SelectTests

 public async Task<List<TestNodeAssembly>> SelectTests(List<string> testAssemblies = null)
 {
     var testsRootNode = await _testsTask;
     testsRootNode.IsIncluded = true;
     if(testAssemblies != null)
     {
         return testsRootNode.TestNodeAssemblies.Where(a => 
             testAssemblies.Select(Path.GetFileNameWithoutExtension).Contains(a.Name)).ToList();
     }
     else
     {
         return testsRootNode.TestNodeAssemblies.ToList();
     }
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:14,代码来源:ITestsSelectStrategy.cs

示例4: GetCouponsDetailByIds

 public List<promotion_coupons_detail> GetCouponsDetailByIds(List<int> ids)
 {
     string id = string.Join(",", ids.Select(t => t));
     string sql = @"SELECT *
                     FROM promotion_coupons_detail
                     where FIND_IN_SET(pkid,@ids)";
     List<promotion_coupons_detail> resultlist = sqlHelper.ExecuteObjects<promotion_coupons_detail>(sql, new MySqlParameter("ids", id));
     return resultlist;
 }
开发者ID:lehprject,项目名称:sfjyDMS,代码行数:9,代码来源:promotion_events_DA.cs

示例5: ToDto

 private List<UsuarioDto> ToDto(List<Usuario> usuarios)
 {
     return usuarios.Select(u => new UsuarioDto {Login = u.Login, Saldo = u.Saldo}).ToList();
 }
开发者ID:TiagoSoczek,项目名称:BSI-ATM,代码行数:4,代码来源:UsuarioService.cs

示例6: SelectMonth

 private void SelectMonth()
 {
     DateTime now = new DateTime(int.Parse(this.YearDropDownList.SelectedValue), 1, 1);
     DateTime startMonth = new DateTime(now.Year, 1, 1);
     List<DateTime> months = new List<DateTime>(12);
     for (int i = 0; i < 12; i++)
     {
         months.Add(startMonth.AddMonths(i));
     }
     this.MonthDropDownList.DataSource = months.Select(m => new { MonthText = m.ToString("MMMM"), m.Month });
     this.MonthDropDownList.DataBind();
     this.SelectDay();
 }
开发者ID:ksikes,项目名称:Amazon.Powershell,代码行数:13,代码来源:PetDetails.aspx.cs

示例7: PerformRandomFlight

        private int[] PerformRandomFlight(int[] xi, double alfa)
        {
            int[] result = new int[n];
            xi.CopyTo(result, 0);

            if(alfa < 0 || alfa >= n ) throw new Exception("Zla alfa");
            var rand = new Random();

            int nrOfElementsToShuffle = (int) (alfa*rand.NextDouble());

            //choosing elements to be shuffled
            var positionsToShuffle = new List<int>();
            var needed = nrOfElementsToShuffle;
            var available = n;

            while (positionsToShuffle.Count < nrOfElementsToShuffle) {
               if( rand.NextDouble() < ((double)needed / available) )
               {
                  positionsToShuffle.Add(xi[available - 1]);
                  needed--;
               }
               available--;
            }

            //CHANGEME
            //shuffling them
            var valuesLeft = positionsToShuffle.Select(i => xi[i]).ToList();

            int left = nrOfElementsToShuffle;
            foreach (int i in positionsToShuffle)
            {
                result[i] = valuesLeft[rand.Next(left)];
            //                valuesLeft.Remove(xi[i]);
                valuesLeft.Remove(result[i]);
                left--;
            }

            if(left != 0) throw new Exception("nie powinnno nic zostac!");

            return result;
        }
开发者ID:Kristofers93,项目名称:qap-project,代码行数:41,代码来源:FireflyAlgorithm.cs


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