本文整理汇总了C#中Common.List.All方法的典型用法代码示例。如果您正苦于以下问题:C# List.All方法的具体用法?C# List.All怎么用?C# List.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.All方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsCircularPrime
static bool IsCircularPrime(Int64 value)
{
var numbers = value.Split();
// todo permutations with only 13, 31 for 13 (make it)
var permutations = numbers.GetPermutations(value.ToString().Length);
var rotations = new List<Int64>();
permutations.ToList().ForEach(p => rotations.Add(long.Parse(String.Concat(p))));
return rotations.All(v => ps.Primes.Contains(v));
}
示例2: FetchReverseCrossRefList
/// <summary>
/// Fetches reverse cross ref list.
/// </summary>
/// <param name="processGuid">The process GUID.</param>
/// <returns>The <see cref="IList" />.</returns>
public IList<PublishedProcessInfoDTO> FetchReverseCrossRefList(Guid processGuid)
{
var result = new List<PublishedProcessInfoDTO>();
const string CmdText =
@"
-- Select processes with cross reference fields
DECLARE @pp_id INT
SELECT @pp_id = pp.[Id] FROM [dbo].[PublishedProcesses] pp WHERE pp.[ProcessGuid] = @processGuid
SELECT pp.[Id]
,p.[Name]
,p.[SystemName]
,p.[Id]
,p.[IsStateEnabled]
,p.[ProcessOption]
FROM [dbo].[PublishedProcesses] pp
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
INNER JOIN (SELECT DISTINCT s.[ProcessId] AS [Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f on f.[SectionId] = s.[Id]
INNER JOIN [dbo].[CrossRefRequredFieldStep] x on x.[FieldId] = f.[Id]
WHERE x.[CrossRefProcessId] = @pp_id) pu ON p.[Id] = pu.[Id]
WHERE pp.Id <> @pp_id
-- Select processes with checklist fields
DECLARE @pp_systemName AS NVARCHAR(200)
SELECT @pp_systemName = p.[SystemName] FROM [dbo].[Processes] p WHERE p.[Guid] = @processGuid AND p.[IsPublishedCopy] = 1 AND p.[IsRemoved] = 0
SELECT pp.[Id]
,p.[Name]
,p.[SystemName]
,p.[Id]
,p.[IsStateEnabled]
,p.[ProcessOption]
FROM [dbo].[PublishedProcesses] pp
INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId]
INNER JOIN (SELECT DISTINCT s.[ProcessId] AS [Id]
FROM [dbo].[Sections] s
INNER JOIN [dbo].[Fields] f on f.[SectionId] = s.[Id]
INNER JOIN [dbo].[stepChecklist] x on x.[FieldId] = f.[Id]
WHERE x.[AnswerProcessSystemName] = @pp_systemName) pu ON p.[Id] = pu.[Id]
WHERE pp.Id <> @pp_id";
using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false))
{
var cn = ctx.Connection;
using (var cmd = new SqlCommand(CmdText, cn))
{
cmd.Parameters.AddWithValue("@processGuid", processGuid);
using (var reader = new SafeDataReader(cmd.ExecuteReader()))
{
do
{
while (reader.Read())
{
var dto = new PublishedProcessInfoDTO
{
Id = reader.GetInt(0),
Name = reader.GetString(1),
SystemName = reader.GetString(2),
ProcessId = reader.GetInt(3),
IsStateEnabled = reader.GetBool(4),
ProcessOption = reader.GetEnum(5, ProcessOption.None)
};
if (result.All(x => x.Id != dto.Id))
{
result.Add(dto);
}
}
}
while (reader.NextResult());
}
}
}
return result;
}
示例3: AskForCompetitors
public void AskForCompetitors(string gameTypeName, List<ICompetitor> emptyCompetitors)
{
IsPlayButtonAvailable = false;
OutputText += string.Format("Waiting for players ({0})\n", emptyCompetitors.Count);
Task.Run(() =>
{
var competitorsTasks = emptyCompetitors.Select(async bot =>
{
try
{
await bot.VerifyAsync(gameTypeName);
lock (_lock)
{
OutputText += string.Format("Bot \"{0}\" connected!\n", bot.Name);
Elimination.Bots.First(f => f.Id == bot.Id).Name = bot.Name;
}
}
catch (Exception e)
{
bot.Name = "Not connected";
OutputText += string.Format("ERROR: Url: {0} - couldn't verify bot!\nError message:\n{1}\n", bot.Url, e.Message);
}
return bot;
}).ToList();
Task.WhenAll(competitorsTasks).ContinueWith(task =>
{
IsPlayButtonAvailable = true;
if (emptyCompetitors.All(competitor => competitor.IsVerified))
{
OutputText += "All players connected!\n";
}
else
{
OutputText += "WARNING: Not all players were succesfully verified.\nTry reconnecting or play tournament without them\n";
}
});
});
}