本文整理汇总了C#中IEnumerable.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.ToList方法的具体用法?C# IEnumerable.ToList怎么用?C# IEnumerable.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumerable
的用法示例。
在下文中一共展示了IEnumerable.ToList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateTestFixture
public string GenerateTestFixture(IEnumerable<Test> tests, string fileName)
{
var generator = new CodeGenerator(TemplateEnum.MbUnitTestFixture, TestText, MethodText, PropertyText, TypeText,
AssertText);
var code = generator.GenerateTestFixture(tests.ToList(), fileName);
return code;
}
示例2: Manage
public ActionResult Manage(IEnumerable<RoleRights> changes)
{
MasterService srv = new MasterService(_Session.MasterTbl);
bool CanCommit = true; string err = "";
//Make sure If there's any DELETE - it is NOT being referred
CanCommit = !MasterController.isDeletedBeingReferred(changes, true, ref err);//.Cast<Master>().ToList()
//Check duplicates among New records only
if (CanCommit && changes != null && changes.ToList<Master>().Exists(r => r.IsAdded))
CanCommit = !MasterController.hasDuplicateInNewEntries(changes, ref err);
#region All OK so go ahead
if (CanCommit)//Commit
{
new SecurityService().BulkAddEditDel(changes.ToList<RoleRights>());//Performs Add, Edit & Delete by chacking each item
base.operationSuccess = true; // Set operation sucess
//Log Activity
new ActivityLogService(ActivityLogService.Activity.RoleManage).Add(new CPM.DAL.ActivityHistory());
}
else // worst case or hack
return Json(err, JsonRequestBehavior.AllowGet);
#endregion
return Json(string.Empty, JsonRequestBehavior.AllowGet);
}
示例3: RequiresRenumbering
public static bool RequiresRenumbering(IEnumerable<int> numbers)
{
List<int> SortedList = Renumber(numbers.ToList());
if (AreEqual(numbers.ToList(), SortedList))
return false;
return true;
}
示例4: EnrichirAvecSoldeArchivable
// Calcul des soldes opérations pour une série d'opérations et une série de comte banque
public void EnrichirAvecSoldeArchivable(IEnumerable<Budget> budgets)
{
// Reset solde opérations
budgets.ToList().ForEach(c => c.SoldeOperationArchivables = 0.0M);
budgets.ToList().ForEach(c => c.SoldeFinancementArchivables = 0.0M);
budgets.ToList().ForEach(c => c.SoldeProvisionArchivables = 0.0M);
budgets.ToList().ForEach(c => c.SoldeArchivable = 0.0M);
// Contrats
var s1 = new BudgetContratEnrichisseur(uow, groupeId);
s1.EnrichirAvecNbContrats(budgets);
// Inputs: opérations
FacadeRepo facade = new FacadeRepo(uow, groupeId);
InputSoldeBudgets inputs = facade.InputSoldeArchivableBudgets(dateLimiteArchivage);
// Enrichissement solde des opérations
var enrichisseur = new BudgetSoldeOperationArchivableEnrichisseur();
enrichisseur.Executer(inputs, budgets);
// Enrichissement solde archive
foreach (var budget in budgets)
{
budget.EnrichirAvecSoldeArchivable();
}
}
示例5: GetFormattedTicket
public string[] GetFormattedTicket(Ticket ticket, IEnumerable<Order> lines, PrinterTemplate printerTemplate)
{
var orders = printerTemplate.MergeLines ? MergeLines(lines.ToList()) : lines.ToList();
ticket.Orders.Clear();
orders.ToList().ForEach(ticket.Orders.Add);
var content = _ticketValueChanger.GetValue(printerTemplate, ticket);
content = UpdateExpressions(content);
return content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
}
示例6: Filter
private static IList<SignatureHelpItem> Filter(IEnumerable<SignatureHelpItem> items, IEnumerable<string> parameterNames)
{
if (parameterNames == null)
{
return items.ToList();
}
var filteredList = items.Where(i => Include(i, parameterNames)).ToList();
return filteredList.Count == 0 ? items.ToList() : filteredList;
}
示例7: AddEntities
public void AddEntities(string variable, IEnumerable<IPersistIfcEntity> entities)
{
FixVariableName(ref variable);
if (IsDefined(variable))
{
_data[variable] = _data[variable].Union(entities.ToList());
}
else
_data.Add(variable, entities.ToList());
_lastVariable = variable;
}
示例8: MagicCard
public MagicCard(Bitmap cameraBitmap, IEnumerable<IntPoint> corners)
{
this.CameraBitmap = cameraBitmap;
QuadrilateralTransformation transformFilter = new QuadrilateralTransformation(corners.ToList(), 211, 298);
this.CardBitmap = transformFilter.Apply(cameraBitmap);
QuadrilateralTransformation cardArtFilter = new QuadrilateralTransformation(artCorners.ToList(), 183, 133);
this.CardArtBitmap = cardArtFilter.Apply(this.CardBitmap);
this.Corners = corners.ToList();
}
示例9: EjectStorageDomainSpectraS3Request
public EjectStorageDomainSpectraS3Request(IEnumerable<Ds3Object> objects, string storageDomainId)
{
this.StorageDomainId = storageDomainId;
this.Objects = objects.ToList();
this.QueryParams.Add("operation", "eject");
this.QueryParams.Add("storage_domain_id", storageDomainId);
if (!objects.ToList().TrueForAll(obj => obj.Size.HasValue))
{
throw new Ds3RequestException(Resources.ObjectsMissingSizeException);
}
}
示例10: SendToConcreteSubscribers
public JeapieResponse SendToConcreteSubscribers(IEnumerable<string> emails, string message, string title ="",
JeapieMessagePriority priority = DefaultPriority)
{
var validationCollection = ParameterValidator.ValidateArguments(message, emails.ToList());
var result = HttpClient.Request(providerKey,
message,
title,
emails.ToList(),
JeapieRequestType.SendToConcreteSubscribers,
priority);
result.ValidationResults.AddRange(validationCollection);
return result;
}
示例11: ValidationResult
/// <summary>
/// Initializes a new instance of the <see cref="ValidationResult"/> class.
/// </summary>
/// <param name="elementResults">The element results.</param>
/// <param name="fieldResults">The field results.</param>
/// <param name="childResults">The child results.</param>
public ValidationResult(IEnumerable<ValidationElementResult> elementResults, IEnumerable<IValidationFieldResult> fieldResults, IEnumerable<ValidationResult> childResults)
{
ElementDirectResults = elementResults.ToList();
ElementDirectFailures = elementResults.Where(result => result.Result.CountsAsFailure).ToList();
ElementResults = childResults.SelectMany(res => res.ElementResults).Union(elementResults.ToList()).ToList();
ElementFailures = ElementResults.Where(result => result.Result.CountsAsFailure);
Results = childResults.SelectMany(res => res.Failures).Union(fieldResults.ToList()).ToList();
Failures = Results.Where(result => result.CountsAsFailure);
ElementResultsCount = ElementResults.AsBindable().Count();
ElementFailureCount = ElementFailures.AsBindable().Count();
ResultsCount = Results.AsBindable().Count();
FailureCount = Failures.AsBindable().Count();
IsSuccessful = FailureCount.Project(count => count == 0);
}
示例12: PrepareToExecute
public Action PrepareToExecute(IEnumerable<CacheElement> toInsert)
{
var insertList = toInsert.ToList();
return () =>
{
foreach (var v in insertList)
{
try
{
this.Checked(raw.sqlite3_bind_text(insertOp, 1, v.Key));
if (String.IsNullOrWhiteSpace(v.TypeName))
{
this.Checked(raw.sqlite3_bind_null(insertOp, 2));
}
else
{
this.Checked(raw.sqlite3_bind_text(insertOp, 2, v.TypeName));
}
this.Checked(raw.sqlite3_bind_blob(insertOp, 3, v.Value));
this.Checked(raw.sqlite3_bind_int64(insertOp, 4, v.Expiration.Ticks));
this.Checked(raw.sqlite3_bind_int64(insertOp, 5, v.CreatedAt.Ticks));
this.Checked(raw.sqlite3_step(insertOp));
}
finally
{
this.Checked(raw.sqlite3_reset(insertOp));
}
}
};
}
示例13: ComposeEmailViewModel
public ComposeEmailViewModel(IEnumerable<Video> videos)
{
Videos = videos.ToList();
Message = new Message();
}
示例14: Write
public void Write(IEnumerable<CommandRegistry> commands)
{
var list = commands.ToList();
Writer.WriteLine("Commands found: {0}", list.Count);
foreach (var cmd in list)
{
Blank();
Writer.Write("Command: ");
WriteCommandName(cmd.Command, cmd.Parser);
var options = cmd.Parser.Options.ToList();
if (options.Count > 0)
{
Writer.WriteLine("Available options:");
foreach (var option in cmd.Parser.Options)
Writer.WriteLine("> {0} [{1}]", option.Name, option.Member.Type.GetRealClassName());
}
else
{
Writer.WriteLine("No available options.");
}
}
}
示例15: ContentTypeDefinition
public ContentTypeDefinition(string name, string displayName, IEnumerable<ContentTypePartDefinition> parts, JObject settings)
{
Name = name;
DisplayName = displayName;
Parts = parts.ToList();
Settings = settings;
}