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


C# List.Select方法代码示例

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


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

示例1: ReadLine

        public override string ReadLine()
        {
            if (stream.Position == stream.Length)
            {
                return null;
            }

            var byteList = new List<int>();
            while (stream.Position != stream.Length)
            {
                int b = stream.ReadByte();
                if (b == (int)'\n')
                {
                    break;
                }
                else
                {
                    byteList.Add(b);
                }
            }
            while (byteList[byteList.Count - 1] == (int)'\r')
            {
                byteList.RemoveAt(byteList.Count - 1);
            }
            return Encoding.UTF8.GetString(byteList.Select(value => (byte)value).ToArray());
        }
开发者ID:KalitaAlexey,项目名称:axxon_soft_test_task,代码行数:26,代码来源:UnbufferedStreamReader.cs

示例2: frmRpt_ListCustomersInGroup

        public frmRpt_ListCustomersInGroup(List<vw__BookingRInfo__BookingRooms_Room_Customers_CustomerGroups> aListCustomerInGroup, string CompanyName, string GroupName)
        {
            InitializeComponent();
            this.aListCustomerInGroup = aListCustomerInGroup;
            this.CompanyName = CompanyName;
            this.GroupName = GroupName;
            var aListCustomer = aListCustomerInGroup.Select(x => new { x.BookingRooms_CheckInActual, x.BookingRooms_CheckInPlan, x.BookingRooms_CheckOutActual, x.BookingRooms_CheckOutPlan, x.Customers_Birthday, x.Customers_Name, x.Customers_Identifier1, x.Rooms_Sku }).Distinct().ToList();

            //Truyền dữ liệu vào report
            lblCompany.Text = this.CompanyName;
            lblGroup.Text = this.GroupName;
            lblNameCustomer.Text = aListCustomer[0].Customers_Name;

            this.DetailReport.DataSource = aListCustomer;
            colCustomerName.DataBindings.Add("Text", this.DetailReport.DataSource, "Customers_Name");
            colBirthday.DataBindings.Add("Text", this.DetailReport.DataSource, "Customers_Birthday", "{0:dd-MM-yyyy}");
            colCheckIn.DataBindings.Add("Text", this.DetailReport.DataSource, "BookingRooms_CheckInActual", "{0:dd-MM-yyyy HH:mm}");
            colCheckOut.DataBindings.Add("Text", this.DetailReport.DataSource, "BookingRooms_CheckOutActual", "{0:dd-MM-yyyy HH:mm}");
            colIndentify.DataBindings.Add("Text", this.DetailReport.DataSource, "Customers_Identifier1");
            colSku.DataBindings.Add("Text", this.DetailReport.DataSource, "Rooms_Sku");
        }
开发者ID:BruceleeThanh,项目名称:Pro_Government_2307,代码行数:21,代码来源:frmRpt_ListCustomersInGroup.cs

示例3: ConnectionsManagerThread

        private void ConnectionsManagerThread()
        {
            Stopwatch connectionCheckStopwatch = new Stopwatch();
            connectionCheckStopwatch.Start();

            Stopwatch refreshStopwatch = new Stopwatch();

            Stopwatch pushBlockDiffusionStopwatch = new Stopwatch();
            pushBlockDiffusionStopwatch.Start();
            Stopwatch pushBlockUploadStopwatch = new Stopwatch();
            pushBlockUploadStopwatch.Start();
            Stopwatch pushBlockDownloadStopwatch = new Stopwatch();
            pushBlockDownloadStopwatch.Start();

            Stopwatch pushMetadataUploadStopwatch = new Stopwatch();
            pushMetadataUploadStopwatch.Start();
            Stopwatch pushMetadataDownloadStopwatch = new Stopwatch();
            pushMetadataDownloadStopwatch.Start();

            for (; ; )
            {
                Thread.Sleep(1000);
                if (this.State == ManagerState.Stop) return;

                var connectionCount = 0;

                lock (this.ThisLock)
                {
                    connectionCount = _connectionManagers.Count;
                }

                if (connectionCount > ((this.ConnectionCountLimit / 3) * 1)
                    && connectionCheckStopwatch.Elapsed.TotalMinutes >= 5)
                {
                    connectionCheckStopwatch.Restart();

                    var nodeSortItems = new List<NodeSortItem>();

                    lock (this.ThisLock)
                    {
                        foreach (var connectionManager in _connectionManagers)
                        {
                            nodeSortItems.Add(new NodeSortItem()
                            {
                                Node = connectionManager.Node,
                                Priority = _messagesManager[connectionManager.Node].Priority,
                                LastPullTime = _messagesManager[connectionManager.Node].LastPullTime,
                            });
                        }
                    }

                    nodeSortItems.Sort((x, y) =>
                    {
                        int c = x.Priority.CompareTo(y.Priority);
                        if (c != 0) return c;

                        return x.LastPullTime.CompareTo(y.LastPullTime);
                    });

                    foreach (var node in nodeSortItems.Select(n => n.Node).Take(1))
                    {
                        ConnectionManager connectionManager = null;

                        lock (this.ThisLock)
                        {
                            connectionManager = _connectionManagers.FirstOrDefault(n => n.Node == node);
                        }

                        if (connectionManager != null)
                        {
                            try
                            {
                                lock (this.ThisLock)
                                {
                                    this.RemoveNode(connectionManager.Node);
                                }

                                connectionManager.PushCancel();

                                Debug.WriteLine("ConnectionManager: Push Cancel");
                            }
                            catch (Exception)
                            {

                            }

                            this.RemoveConnectionManager(connectionManager);
                        }
                    }
                }

                if (!refreshStopwatch.IsRunning || refreshStopwatch.Elapsed.TotalSeconds >= 30)
                {
                    refreshStopwatch.Restart();

                    // トラストにより必要なMetadataを選択し、不要なMetadataを削除する。
                    ThreadPool.QueueUserWorkItem((object wstate) =>
                    {
                        if (_refreshThreadRunning) return;
                        _refreshThreadRunning = true;
//.........这里部分代码省略.........
开发者ID:networkelements,项目名称:Library,代码行数:101,代码来源:ConnectionsManager.cs


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