本文整理汇总了C#中Common.List.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToList方法的具体用法?C# List.ToList怎么用?C# List.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.ToList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAvailableToHidePair
private static IndexPair GetAvailableToHidePair(GameFieldModel model, List<IndexPair> pairs, CancellationToken token, int rank)
{
foreach (var pair in pairs.ToList())
{
token.ThrowIfCancellationRequested();
model.SetItemVisible(pair, false);
if (GetHeuristicsAvailableNumbers(model, pair, rank).Count() <= 1)
return pair;
model.SetItemVisible(pair, true);
pairs.Remove(pair);
}
return null;
}
示例2: OnGetFilteredArchive
public static List<FS2JournalItem> OnGetFilteredArchive(ArchiveFilter archiveFilter, bool isReport)
{
var result = new List<FS2JournalItem>();
try
{
string dateInQuery = "DeviceTime";
if (archiveFilter.UseSystemDate)
dateInQuery = "SystemTime";
var query =
"SELECT * FROM Journal WHERE " +
"\n " + dateInQuery + " > '" + archiveFilter.StartDate.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
"\n AND " + dateInQuery + " < '" + archiveFilter.EndDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";
if (archiveFilter.Descriptions.Count > 0)
{
query += "\n AND (";
for (int i = 0; i < archiveFilter.Descriptions.Count; i++)
{
if (i > 0)
query += "\n OR ";
var description = archiveFilter.Descriptions[i];
description = description.Replace("'", "''");
query += " Description = '" + description + "'";
}
query += ")";
}
if (archiveFilter.Subsystems.Count > 0)
{
query += "\n AND (";
for (int i = 0; i < archiveFilter.Subsystems.Count; i++)
{
if (i > 0)
query += "\n OR ";
var subsystem = archiveFilter.Subsystems[i];
query += " SubSystemType = '" + ((int)subsystem).ToString() + "'";
}
query += ")";
}
if (archiveFilter.PanelUIDs.Count > 0)
{
query += "\n AND (";
for (int i = 0; i < archiveFilter.PanelUIDs.Count; i++)
{
var panelUID = archiveFilter.PanelUIDs[i];
if (panelUID != null)
{
if (i > 0)
query += "\n OR ";
query += " PanelUID = '" + panelUID + "'";
}
}
query += ")";
}
query += "\n ORDER BY " + dateInQuery + " DESC";
using (var sqlCeConnection = new SqlCeConnection(ConnectionString))
{
sqlCeConnection.ConnectionString = ConnectionString;
var journalItems = new List<FS2JournalItem>();
var sqlCeCommand = new SqlCeCommand(query, sqlCeConnection);
sqlCeConnection.Open();
var reader = sqlCeCommand.ExecuteReader();
while (reader.Read())
{
if (IsAbort && !isReport)
break;
try
{
var journalItem = ReadOneJournalItem(reader);
result.Add(journalItem);
if (!isReport)
{
journalItems.Add(journalItem);
if (journalItems.Count > 100)
{
if (ArchivePortionReady != null)
ArchivePortionReady(journalItems.ToList());
journalItems.Clear();
}
}
}
catch (Exception e)
{
Logger.Error(e, "DatabaseHelper.OnGetFilteredArchive");
}
}
if (!isReport)
{
if (ArchivePortionReady != null)
ArchivePortionReady(journalItems.ToList());
}
sqlCeConnection.Close();
}
}
//.........这里部分代码省略.........
示例3: ClrNamespace
public void ClrNamespace()
{
var type = typeof(DummyClass);
string clrNamespace = $"clr-namespace:{type.Namespace};Assembly={type.GetTypeInfo().Assembly.GetName().Name}";
var prefix = "prefix";
var input = new List<ProtoInstruction>
{
P.NamespacePrefixDeclaration(prefix, clrNamespace),
P.EmptyElement(type, RootNs),
};
var expectedInstructions = new List<Instruction>
{
X.NamespacePrefixDeclaration(clrNamespace, prefix),
X.StartObject<DummyClass>(),
X.EndObject(),
};
var actualNodes = sut.Parse(input);
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
示例4: NamespaceDeclarationOnly
public void NamespaceDeclarationOnly()
{
var input = new List<ProtoInstruction>
{
P.NamespacePrefixDeclaration(RootNs),
};
var expectedInstructions = new List<Instruction>
{
X.NamespacePrefixDeclaration(RootNs),
};
var actualNodes = sut.Parse(input);
Assert.Equal(expectedInstructions.ToList(), actualNodes.ToList());
}
示例5: VipOrder
public ActionResult VipOrder()
{
int status = 0;
int mid = 0;
List<Model.OrderBase> order = new List<Model.OrderBase>();
List<Model.vw_Orderpinfo> lvlist = new List<Model.vw_Orderpinfo>();
if (!string.IsNullOrEmpty(RequestBase.GetString("status")))
{
status = Convert.ToInt32(RequestBase.GetString("status"));
ViewData["status"] = status;
}
if (LoginMember != null)
{
mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID;
if (status == 0)
{
order = new BLL.OrderBase().GetModelList(" m_ID=" + mid + " and o_IsDel=0 and o_StatusCode=" + status + " or o_StatusCode=5 ");
lvlist = vobll.GetModelList(" o_IsDel=0 and m_ID=" + mid + " and o_StatusCode=" + status + " or o_StatusCode=5 ");//5是退货
}
else if (status ==23)
{
order = new BLL.OrderBase().GetModelList(" m_ID=" + mid + " and o_IsDel=0 and o_StatusCode=2 or o_StatusCode=3");
lvlist = vobll.GetModelList(" o_IsDel=0 and m_ID=" + mid + " and o_StatusCode=2 or o_StatusCode=3");
}
else
{
order = new BLL.OrderBase().GetModelList(" m_ID=" + mid + " and o_IsDel=0 and o_StatusCode=" + status);
lvlist = vobll.GetModelList(" o_IsDel=0 and m_ID=" + mid + " and o_StatusCode=" + status);
}
ViewBag.order = order;
return View(lvlist.ToList());
}
else
{
Response.Redirect("/wapLogin/Login");
return View();
}
}
示例6: OnGetFilteredArchive
public static OperationResult<List<JournalRecord>> OnGetFilteredArchive(ArchiveFilter archiveFilter, bool isReport)
{
var operationResult = new OperationResult<List<JournalRecord>>();
operationResult.Result = new List<JournalRecord>();
try
{
string dateInQuery = "DeviceTime";
if (archiveFilter.UseSystemDate)
dateInQuery = "SystemTime";
var query =
"SELECT * FROM Journal WHERE " +
"\n " + dateInQuery + " > '" + archiveFilter.StartDate.ToString("yyyy-MM-dd HH:mm:ss") + "'" +
"\n AND " + dateInQuery + " < '" + archiveFilter.EndDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";
if (archiveFilter.Descriptions.Count > 0)
{
query += "\n AND (";
for (int i = 0; i < archiveFilter.Descriptions.Count; i++)
{
if (i > 0)
query += "\n OR ";
var description = archiveFilter.Descriptions[i];
description = description.Replace("'", "''");
query += " Description = '" + description + "'";
}
query += ")";
}
if (archiveFilter.Subsystems.Count > 0)
{
query += "\n AND (";
for (int i = 0; i < archiveFilter.Subsystems.Count; i++)
{
if (i > 0)
query += "\n OR ";
var subsystem = archiveFilter.Subsystems[i];
query += " SubSystemType = '" + ((int)subsystem).ToString() + "'";
}
query += ")";
}
if (archiveFilter.PanelUIDs.Count > 0)
{
query += "\n AND (";
for (int i = 0; i < archiveFilter.PanelUIDs.Count; i++)
{
var deviceName = archiveFilter.PanelUIDs[i];
if (deviceName != null)
{
if (i > 0)
query += "\n OR ";
query += " PanelDatabaseId = '" + deviceName + "'";
}
}
query += ")";
}
query += "\n ORDER BY " + dateInQuery + " DESC";
using (var DataBaseContext = new SqlCeConnection(ConnectionString))
{
DataBaseContext.ConnectionString = ConnectionString;
var journalRecords = new List<JournalRecord>();
var result = new SqlCeCommand(query, DataBaseContext);
DataBaseContext.Open();
var reader = result.ExecuteReader();
while (reader.Read())
{
if (IsAbort && !isReport)
break;
try
{
var journalRecord = ReadOneJournalRecord(reader);
operationResult.Result.Add(journalRecord);
if (!isReport)
{
journalRecords.Add(journalRecord);
if (journalRecords.Count > 100)
{
if (ArchivePortionReady != null)
ArchivePortionReady(journalRecords.ToList());
journalRecords.Clear();
}
}
}
catch (Exception e)
{
Logger.Error(e, "DatabaseHelper.OnGetFilteredArchive");
}
}
if (!isReport)
{
if (ArchivePortionReady != null)
ArchivePortionReady(journalRecords.ToList());
}
DataBaseContext.Close();
}
//.........这里部分代码省略.........