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


C# List.Take方法代码示例

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


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

示例1: OnShowZones

		void OnShowZones()
		{
			var zonesSelectionViewModel = new ZonesSelectionViewModel(Device, Zones);
			if (DialogService.ShowModalWindow(zonesSelectionViewModel))
			{
				Zones = zonesSelectionViewModel.Zones;
				Zones = Zones.Take(50).ToList();
				OnPropertyChanged("PresenrationZones");
			}
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:10,代码来源:IndicatorPageDetailsViewModel.cs

示例2: Execute

        private void Execute()
        {
            List<byte> rxBuff = new List<byte>();

            while(true)
            {
                byte[] read = new byte[1];

                try
                {
                    // Read
                    int rxed = _socket.Receive(read, read.Length, SocketFlags.None);

                    // Add data to buffer
                    rxBuff.AddRange(read.Take(rxed));

                    // process data if it contains a terminating character
                    if (rxBuff.Contains(0x02))
                    {
                        // retreive the string
                        string rxStr = Encoding.UTF8.GetString(rxBuff.Take(rxBuff.IndexOf(0x02)).ToArray());
                        // remove the data that was just converted into a string (plus the 0x02 terminator)
                        rxBuff.RemoveRange(0, rxBuff.IndexOf(0x02) + 1);

                        // Deserialize to the message structure
                        Message msg = JsonConvert.DeserializeObject<Message>(rxStr);

                        // Notify all listeners
                        if (msg != null)
                        {
                            OnMessageRxed(msg);
                        }
                    }
                }
                catch
                {
                    OnDisconnected();
                }
            }
        }
开发者ID:branchjoshua,项目名称:cse3461,代码行数:40,代码来源:MessageXcvr.cs

示例3: GetTagList

        /// <summary>
        /// 获取Tag集合
        /// </summary>
        public List<TagInfo> GetTagList(int tid, int count)
        {
            List<TagInfo> tags = new List<TagInfo>();

            IQueryable<blog_varticle> articles=GetArticles(tid, 0,0);
            string tagstr = "";
            foreach (blog_varticle article in articles)
            {
                tagstr += article.tags.Trim() + ",";
            }

            string[] arrTag = tagstr.Split(',');
            arrTag = Utils.DistinctStringArray(arrTag);

            foreach (string a in arrTag)
            {
                if (a.Trim() != "")
                {
                    tags.Add(new TagInfo { Tag = a.Trim(), Count = Utils.RegexCount(a, tagstr) });
                }
            }
            tags.Sort(delegate(TagInfo x, TagInfo y) { return y.Count - x.Count; });

            if (count > 0)
                tags = tags.Take(count).ToList();

            return tags;
        }
开发者ID:menghuantianya,项目名称:MVCDemo,代码行数:31,代码来源:RssServiceImpl.cs

示例4: ShowMoreRecords

        /// <summary>
        /// Function to get more search records.
        /// </summary>
        /// <param name="presenter">The presenter</param>
        /// <param name="numberOfRecords">The number of records.</param>
        /// <param name="searchText">The search text.</param>
        /// <returns>
        /// The partial view
        /// </returns>
        public ActionResult ShowMoreRecords(GlobalSearchPresenter presenter, int numberOfRecords, string searchText)
        {
            if (presenter != null)
            {
                IList<SearchResultItem> searchResult = new List<SearchResultItem>();
                if (SessionData.Instance.GlobalSearchItems != null)
                {
                    IList<SearchResultItem> searchRecordList = new List<SearchResultItem>();
                    searchRecordList = SessionData.Instance.GlobalSearchItems;
                    presenter.AssignAllSearchRecordList(searchRecordList);
                    int totalCount = presenter.RecordCount + numberOfRecords;
                    presenter.RecordCount = totalCount < searchRecordList.Count ? totalCount : searchRecordList.Count;
                    searchResult = searchRecordList.Take(presenter.RecordCount).ToList<SearchResultItem>();
                    presenter.AssignSearchResultList(searchResult);
                }
            }

            return this.PartialView(SearchRecordsPartialView, presenter);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:28,代码来源:GlobalSearchController.cs


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