• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Common.List类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



List类属于Common命名空间,在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Search

        public ActionResult Search(string query)
        {
            ViewData["Message"] = "query : " + query;

            var searcher = new IndexSearcher(
                new Lucene.Net.Store.SimpleFSDirectory(new DirectoryInfo(Configuration.IndexDirectory)),
                readOnly: true);

            var fieldsToSearchIn = new[] {Configuration.Fields.Name, Configuration.Fields.Description};
            var queryanalizer = new MultiFieldQueryParser(Version.LUCENE_CURRENT,
                                                          fieldsToSearchIn,
                                                          new BrazilianAnalyzer());

            var numberOfResults = 10;
            var top10Results = searcher.Search(queryanalizer.Parse(query), numberOfResults);
            var docs = new List<DocumentViewModel>();
            foreach (var scoreDoc in top10Results.scoreDocs)
            {
                var document = searcher.Doc(scoreDoc.doc);
                var name = document.GetField(Configuration.Fields.Name).StringValue();
                var description = document.GetField(Configuration.Fields.Description).StringValue();
                var link = document.GetField(Configuration.Fields.Link).StringValue();
                docs.Add(new DocumentViewModel(name, description, link));
            }
            return View(new SearchViewModel(docs));
        }
开发者ID:brunomlopes,项目名称:techdays2010pt-lucene,代码行数:26,代码来源:HomeController.cs


示例2: GetBindingContext

        private object GetBindingContext(Type viewType)
        {
            var viewModelType = _viewsByType[viewType];

            ConstructorInfo constructor = null;

            var parameters = new object[] { };

            constructor = viewModelType.Type.GetTypeInfo()
                   .DeclaredConstructors
                   .FirstOrDefault(c => !c.GetParameters().Any());

            if (constructor == null)
            {
                constructor = viewModelType.Type.GetTypeInfo()
                   .DeclaredConstructors.First();

                var parameterList = new List<object>();

                foreach (var param in constructor.GetParameters())
                    parameterList.Add(_injection.Get(param.ParameterType));

                parameters = parameterList.ToArray();
            }

            if (constructor == null)
                throw new InvalidOperationException(
                    $"No suitable constructor found for ViewModel {viewModelType.ToString()}");

            return constructor.Invoke(parameters);
        }
开发者ID:exrin,项目名称:Exrin,代码行数:31,代码来源:ViewService.cs


示例3: GetState

 public static SelectList GetState()
 {
     List<object> sl = new List<object>();
     sl.Add(new { Id = "未审核", Text = "未审核" });
     sl.Add(new { Id = "已审核", Text = "已审核" });
     return new SelectList(sl, "Id", "Text");
 }
开发者ID:Langbencom,项目名称:WeiXiu,代码行数:7,代码来源:SysFieldModels.cs


示例4: ClearElements

		public void ClearElements()
		{
			ElementRectangleSubPlans = new List<ElementRectangleSubPlan>();
			ElementPolygonSubPlans = new List<ElementPolygonSubPlan>();
			ElementRectangles = new List<ElementRectangle>();
			ElementEllipses = new List<ElementEllipse>();
			ElementTextBlocks = new List<ElementTextBlock>();
			ElementTextBoxes = new List<ElementTextBox>();
			ElementPolygons = new List<ElementPolygon>();
			ElementPolylines = new List<ElementPolyline>();

			ElementGKDevices = new List<ElementGKDevice>();
			ElementRectangleGKZones = new List<ElementRectangleGKZone>();
			ElementPolygonGKZones = new List<ElementPolygonGKZone>();
			ElementRectangleGKGuardZones = new List<ElementRectangleGKGuardZone>();
			ElementPolygonGKGuardZones = new List<ElementPolygonGKGuardZone>();
			ElementRectangleGKSKDZones = new List<ElementRectangleGKSKDZone>();
			ElementPolygonGKSKDZones = new List<ElementPolygonGKSKDZone>();
			ElementRectangleGKDelays = new List<ElementRectangleGKDelay>();
			ElementPolygonGKDelays = new List<ElementPolygonGKDelay>();
			ElementRectangleGKPumpStations = new List<ElementRectangleGKPumpStation>();
			ElementPolygonGKPumpStations = new List<ElementPolygonGKPumpStation>();
			ElementRectangleGKDirections = new List<ElementRectangleGKDirection>();
			ElementPolygonGKDirections = new List<ElementPolygonGKDirection>();
			ElementRectangleGKMPTs = new List<ElementRectangleGKMPT>();
			ElementPolygonGKMPTs = new List<ElementPolygonGKMPT>();
			ElementGKDoors = new List<ElementGKDoor>();

			ElementExtensions = new List<ElementBase>();
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:30,代码来源:Plan.cs


示例5: RetrieveList

 /// <summary>
 /// Retrieves master detail list.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>
 /// List of master details
 /// </returns>
 public IList<MasterDetail> RetrieveList(int userId)
 {
     var roleList = this.roleGroupRepository.RetrieveRoleGroupList(userId);
     var masterList = new List<MasterDetail>();
     roleList.ForEach(role => masterList.Add(MapToMasterDetails(role)));
     return masterList;
 }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:14,代码来源:RoleGroupService.cs


示例6: Index

        public ActionResult Index()
        {
            try
            {
                if (Session["accountID"] != null)
                {
                    List<Order> orderList = new OrderClient().GetBoughtOrdersByAccountID((int)Session["accountID"]).ToList();

                    List<ProductOrder> allPO = new List<ProductOrder>();

                    foreach (Order o in orderList)
                    {
                        List<ProductOrder> productOrderlist = new OrderClient().GetWarrantyUnexpiredOrdersByOrderID(o.ID).ToList();

                        foreach (ProductOrder po in productOrderlist)
                        {
                            allPO.Add(po);
                        }
                    }
                    return View("Index", allPO);
                }
                else
                {
                    return RedirectToAction("Login", "Login");
                }
            }
            catch (Exception e)
            {
                ViewBag.Error = "An error has occured.";
                return View("Index", new List<ProductOrder>());
            }
        }
开发者ID:ClaireG90,项目名称:DSA,代码行数:32,代码来源:GenerateFaultController+(2).cs


示例7: addTLose

        /**
           * 添加变损信息
           * @param       ref List<TransformerLoseInfo> t_lose:变损信息
           * @return      int 值为Constant.OK:执行成功,值为Constant.ERROR为执行失败
           * @author      Rick
           **/
        public int addTLose(ref List<TransformerLose> t_lose)
        {
            //string strAdd = "insert into AreaInfo values (" + areaInfo.AreaNo + ",'" + areaInfo.AreaName + "'," + areaInfo.AreaFlag + ", getdate())";
            int count = t_lose.Count;
            int i = 0;
            List<string> listSql = new List<string>();

            while (count > 0)
            {
                string strAdd = "insert into TransformerLoseInfo values (" + t_lose[i].TransformerLoseNo + ", '" + t_lose[i].TransformerType + "'," + t_lose[i].StandarVolume + ", " + t_lose[i].MonthUsed + "," + t_lose[i].TranformerLose + "," + t_lose[i].LessOrMoreFlag + ")";
                listSql.Add(strAdd);

                count = count - 1;
                i = i + 1;
            }

            try
            {
                SQLUtl.ExecuteSqlTran(listSql);
                return Constant.OK;
            }
            catch (Exception)
            {
                return Constant.ERROR;
            }
        }
开发者ID:beyondliangcai,项目名称:PowerMis,代码行数:32,代码来源:TransformerLoseAction.cs


示例8: GetHistoryCards

        public List<HistoryCardViewModel> GetHistoryCards()
        {
            var historyCards = _db.GetHistoryCards();

            var historyCardsViewModel = new List<HistoryCardViewModel>();
            foreach (var history in historyCards)
            {
                var model = new HistoryCardViewModel();

                foreach (var subscriber in history.Subscribers.Take(3))
                {
                    model.Users.Add(new Subscriber()
                    {
                        FirstName = subscriber.FirstName,
                        LastName = subscriber.LastName,
                        SmallPhoto = subscriber.SmallPhoto
                    });
                }

                model.Goal = history.Title;
                model.Created = history.created.Value;
                model.TotalPeopleCount = history.Subscribers.Count;
                model.DisplayPeopleCount = 3;

                historyCardsViewModel.Add(model);
            }

            return historyCardsViewModel;
        }
开发者ID:amarfut,项目名称:finder,代码行数:29,代码来源:HistoryCardService.Partial.cs


示例9: GetCorrelogram

        public static List<double> GetCorrelogram(List<double> excerpt, int k)
        {
            // sum of all elements
            double sum = excerpt.Sum();
            // init lsum (only left elements) and rsum (only right elements)
            // theirs size will be decreased
            double lsum = sum, rsum = sum;
            List<double> crl = new List<double> { 1 };
            for (int i = 1; i <= k; i++)
            {
                // subtract last left element from rsum
                rsum -= excerpt[i - 1];
                // subtract last right element from lsum
                lsum -= excerpt[excerpt.Count - i];
                // reduction of sum by dividing by N-K
                double rusum = rsum / (excerpt.Count - i), lusum = lsum / (excerpt.Count - i);
                // abv is expression in numerator

                double abv = 0, lund = 0, rund = 0;
                for (int j = 0; j < excerpt.Count - i; j++)
                {
                    abv += (excerpt[j] - lusum) * (excerpt[j + i] - rusum);
                    lund += (excerpt[j] - lusum) * (excerpt[j] - lusum);
                    rund += (excerpt[j + i] - rusum) * (excerpt[j + i] - rusum);
                }
                double und = Math.Sqrt(rund * lund);
                double val = abv == und ? 1.0 : abv / und;
                crl.Add(val);
            }
            return crl;
        }
开发者ID:SanyoGorbunov,项目名称:univer-projects,代码行数:31,代码来源:RandomExcerptChecker.cs


示例10: ReceiveAndCheckAsync

 private static async Task ReceiveAndCheckAsync(UdpClient client, string expectedMessage)
 {
         var incomingBytes = new List<byte>();
     var connectionReset=false;
     try
     {
         do
         {
             var udpReceiveResult = await client.ReceiveAsync();
             incomingBytes.AddRange(udpReceiveResult.Buffer);
         } while (TcpMessenger.IsReadingShouldContinue(incomingBytes));
     }
     catch (SocketException ex)
     {
         if (ex.SocketErrorCode == SocketError.ConnectionReset)
         {
             connectionReset = true;
         }
     }
     var actual = Encoding.UTF8.GetString(incomingBytes.ToArray());
     if (connectionReset)
     {
         TcpMessenger.ErrorConnectionReset(actual);
     }
     else if (actual != expectedMessage)
     {
         TcpMessenger.ErrorWrongMessage(actual);
     }
 }
开发者ID:axxeny,项目名称:ServerEfficiencyTest,代码行数:29,代码来源:UdpConsumer.cs


示例11: Index

        public ActionResult Index(Guid? customerId, string keywords, bool? finish, int pageIndex = 1, int pageSize = 10)
        {
            var model = _iProjectInfoService.GetAll(a => a.Public);

            if (customerId.HasValue)
                model = model.Where(a => a.CustomerId == customerId);

            if (!string.IsNullOrEmpty(keywords))
            {
                model =
                    model.Where(
                        a =>
                        a.ProjectName.Contains(keywords) || a.ProjectObjective.Contains(keywords) ||
                        a.Tag.Contains(keywords) || a.ProjectUsers.Any(b => b.SysUser.UserName == keywords));
            }

            if (finish.HasValue)
            {
                model = model.Where(a => a.Finish == finish);
            }

            //子项目
            var subModel = model.Where(a => a.LastProjectInfoId != null);
            //主项目
            var mainModel = model.Where(a => a.LastProjectInfoId == null).ToPagedList(pageIndex, pageSize);

            var mainList = new List<ProjectInfo>() { };
            foreach (var item in mainModel)
            {
                mainList.Add(item);
                mainList.AddRange((subModel as IQueryable<ProjectInfo>).Where(a => a.LastProjectInfoId == item.Id));
            }

            var result = mainList.Select(
                a => new
                {
                    a.Id,
                    a.UserId,
                    Leader = a.ProjectUsers != null ? a.ProjectUsers.Where(b => b.Leader).Select(b => b.SysUser.DisplayName) : null,
                    ProjectInfoState = a.ProjectInfoState != null ? a.ProjectInfoState.ProjectInfoStateName : null,
                    Follow = a.Public && (a.ProjectUsers!=null ? a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && b.Follow): false),
                    a.LastProjectInfoId,
                    a.Raty,
                    a.Public,
                    PlanCount = a.Plans.Count(p => !p.Deleted),
                    TaskCount = a.ProjectTasks.Count(t => !t.Deleted),
                    ReplyCount = a.ProjectInfoReplys.Count(r => !r.Deleted),
                    MemberCount = a.ProjectUsers != null ? a.ProjectUsers.Count(b => !b.Follow) : 0,
                    a.CustomerId,
                    a.Tag,
                    a.StarTime,
                    a.EndTime,
                    a.Finish,
                    a.ProjectName,
                    a.ProjectObjective,
                    a.CreatedDate
                });

            return Content(JsonConvert.SerializeObject(result), "text/json");
        }
开发者ID:b9502032,项目名称:MySite,代码行数:60,代码来源:AllWorkController.cs


示例12: RetrieveList

 /// <summary>
 /// Retrieves master detail list.
 /// </summary>
 /// <param name="userId">The user identifier.</param>
 /// <returns>
 /// List of master details
 /// </returns>
 public IList<MasterDetail> RetrieveList(int userId)
 {
     ////var artifactList = this.artifactRepository.RetrieveArtifactList(projectId, releaseCalendarId, artifactType, userId);
     var masterList = new List<MasterDetail>();
     ////artifactList.ForEach(artifact => masterList.Add(MapArtifactFillListItemToMasterDetails(artifact)));
     return masterList;
 }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:14,代码来源:ArtifactService.cs


示例13: GetLongestChain

        static int GetLongestChain(int d1, int d2, int d3, int d4)
        {
            bool[] numbers = new bool[10000];
            for (int op1 = 0; op1 < 4; op1++)
            {
                for (int op2 = 0; op2 < 4; op2++)
                {
                    for (int op3 = 0; op3 < 4; op3++)
                    {
                        var list = new List<object>() { Operands[op1], Operands[op2], Operands[op3], d1, d2, d3, d4 };
                        foreach (var permutation in Permutator.Permutate(list.Count))
                        {
                            var list2 = new List<object>(list.Count) {null, null, null, null, null, null, null};
                            int count = 0;
                            foreach (int i in permutation)
                                list2[i] = list[count++];

                            var result = CalculatePolishNotatation(list2);
                            if (double.IsNaN(result) || double.IsInfinity(result)|| result < 0 || Math.Abs(result - Math.Round(result))> 1e-8)
                                continue;

                            numbers[(int)result] = true;
                        }
                    }
                }
            }
            for (int i = 1; i < numbers.Length; i++)
            {
                if (numbers[i] == false)
                    return i - 1;
            }
            return 0;
        }
开发者ID:balazsmolnar,项目名称:Euler,代码行数:33,代码来源:Program.cs


示例14: CalculatePolishNotatation

        static double CalculatePolishNotatation(List<object> tags)
        {
            Stack<double> stack = new Stack<double>();
            int index = tags.Count - 1;
            while (index > -1)
            {
                var o = tags[index];
                if (o is int)
                {
                    stack.Push((int)o);
                }
                if (o is Func<double, double, double>)
                {
                    var operation = (Func<double, double, double>)o;
                    if (stack.Count < 2)
                        return double.NaN;
                    var operand1 = stack.Pop();
                    var operand2 = stack.Pop();
                    stack.Push(operation(operand1, operand2));
                }
                index--;

            }
            if (stack.Count == 1)
                return stack.Pop();

            return double.NaN;
        }
开发者ID:balazsmolnar,项目名称:Euler,代码行数:28,代码来源:Program.cs


示例15: CreateDeviceDependentResources

        protected override void CreateDeviceDependentResources()
        {
            base.CreateDeviceDependentResources();

            RemoveAndDispose(ref vertexBuffer);

            // Retrieve our SharpDX.Direct3D11.Device1 instance
            var device = this.DeviceManager.Direct3DDevice;

            List<Vertex> vertices = new List<Vertex>();

            vertices.AddRange(new[] {
                new Vertex(0, 0, -4, Vector3.UnitY, Color.Blue),
                new Vertex(0, 0, 4,Vector3.UnitY,  Color.Blue),
                new Vertex(-4, 0, 0, Vector3.UnitY, Color.Red),
                new Vertex(4, 0, 0,Vector3.UnitY,  Color.Red),
            });
            for (var i = -4f; i < -0.09f; i += 0.2f)
            {
                vertices.Add(new Vertex(i, 0, -4, Color.Gray));
                vertices.Add(new Vertex(i, 0, 4, Color.Gray));
                vertices.Add(new Vertex(-i, 0, -4, Color.Gray));
                vertices.Add(new Vertex(-i, 0, 4, Color.Gray));

                vertices.Add(new Vertex(-4, 0, i, Color.Gray));
                vertices.Add(new Vertex(4, 0, i, Color.Gray));
                vertices.Add(new Vertex(-4, 0, -i, Color.Gray));
                vertices.Add(new Vertex(4, 0, -i, Color.Gray));
            }
            vertexCount = vertices.Count;
            vertexBuffer = ToDispose(Buffer.Create(device, BindFlags.VertexBuffer, vertices.ToArray()));
        }
开发者ID:QamarWaqar,项目名称:Direct3D-Rendering-Cookbook,代码行数:32,代码来源:AxisGridRenderer.cs


示例16: TestSpearmanMethod

 public static Result TestSpearmanMethod(List<double> excerpt)
 {
     double[,] h = new double[excerpt.Count - 1, excerpt.Count - 1];
     for (int i = 0; i < excerpt.Count - 1; i++)
     {
         for (int j = i + 1; j < excerpt.Count; j++)
         {
             if (excerpt[i] == excerpt[j])
             {
                 h[i, j - 1] = 0.5;
             }
             else if (excerpt[i] < excerpt[j])
             {
                 h[i, j - 1] = 1;
             }
         }
     }
     double v = 0;
     for (int i = 0; i < excerpt.Count - 1; i++)
     {
         for (int j = i + 1; j < excerpt.Count; j++)
         {
             v += (j - 1) * h[i, j - 1];
         }
     }
     double rc = 1 - 12 * v / excerpt.Count / (excerpt.Count * excerpt.Count - 1);
     double d = 1.0 / (excerpt.Count - 1);
     double s = rc / Math.Sqrt(d);
     double q = DistributionHelper.GetNormalDistributionQuantile(TimeSeriesEnvironment.Current.Alpha);
     return new Result(q, s);
 }
开发者ID:SanyoGorbunov,项目名称:univer-projects,代码行数:31,代码来源:RandomExcerptChecker.cs


示例17: AddHistoryItem

		public List<ElementBase> AddHistoryItem(List<ElementBase> elementsBefore)
		{
			var elementsAfter = DesignerCanvas.CloneElements(DesignerCanvas.SelectedItems);
			if (!_historyAction)
				AddHistoryItem(elementsBefore, elementsAfter, ActionType.Edited);
			return elementsAfter;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:7,代码来源:BasePlanDesignerViewModel.History.cs


示例18: GetList

 public List<Sys_RoleTemplate> GetList(int RoleId)
 {
     string sql = "select * from Sys_RoleTemplate where [email protected]";
     List<SqlParam> pars = new List<SqlParam>();
     pars.Add(new SqlParam("RoleId", RoleId));
     return new Helper().ExecuteList<Sys_RoleTemplate>(sql, pars);
 }
开发者ID:bIgMunich,项目名称:Re,代码行数:7,代码来源:Sys_RoleTemplateDAL.cs


示例19: CheckTasks

		void CheckTasks()
		{
			try
			{
				var actions = new List<Action>();
				lock (locker)
				{
					if (Tasks == null)
					{
						Tasks = new Queue<Action>();
						Logger.Error("Watcher.CheckTasks Tasks = null");
					}

					while (Tasks.Count > 0)
					{
						var action = Tasks.Dequeue();
						if (action != null)
						{
							actions.Add(action);
						}
					}
				}
				foreach (var action in actions)
				{
					action();
				}
			}
			catch (Exception e)
			{
				Logger.Error(e, "Watcher.CheckTasks");
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:32,代码来源:Watcher.Tasks.cs


示例20: RetrievePerson

        /// <summary>
        /// Reset alert collection for Guest
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventType">Instance of NotificationEventType</param>
        public static void RetrievePerson(NotificationEvent message, NotificationEventType eventType)
        {
            List<PersonType> personTypeList = new List<PersonType>();
            if (message != null && message.PersonTypeId == CommonConstants.GuestTypeId)
            {
                personTypeList.Add(PersonType.Guest);
            }
            else if (message != null && message.PersonTypeId == CommonConstants.CrewmemberTypeId)
            {
                personTypeList.Add(PersonType.Crewmember);
            }
            else if (message != null && message.PersonTypeId == CommonConstants.VisitorTypeId)
            {
                personTypeList.Add(PersonType.Visitor);
            }

            if (eventType == NotificationEventType.Reservation)
            {
                RetrieveGuestForReservation(message, eventType, personTypeList);
            }
            else
            {
                RetrieveGuest(message, eventType, personTypeList);
            }
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:30,代码来源:NotificationManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Common.Model类代码示例发布时间:2022-05-24
下一篇:
C# Constants.Sql类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap