本文整理汇总了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());
}
示例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");
}
示例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;
//.........这里部分代码省略.........