本文整理汇总了C#中IList.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# IList.ToList方法的具体用法?C# IList.ToList怎么用?C# IList.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.ToList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnteprimaReportRipartoPersona
public AnteprimaReportRipartoPersona(IList<ReportRipartizioneBilancioDTO> dataSource, CondominioDTO condominio, EsercizioDTO esercizio, IList<PersonaContattoDTO> personeRiparto, Dictionary<int, IList<IList<UnitaImmobiliareListaDTO>>> listaUnitaImmobiliare, BilancioConsuntivoReportParameters parameters, ImpostazioneReportDTO impostazioneReportDTO, string reportKey, string note)
{
InitializeComponent();
_dataSource = dataSource;
_condominio = condominio;
_esercizio = esercizio;
_parameters = parameters;
_personeRiparto = personeRiparto;
_impostazioneReportDTO = impostazioneReportDTO;
_note = note;
Text = $"Riparto {_impostazioneReportDTO.Descrizione}";
try
{
_importoTotale = getBilancioService().GetTotale(dataSource.ToList());
_importoPreventivo = getBilancioService().GetTotalePreventivo(dataSource.ToList());
IReportProvider document = new RipartoAnnualePersona(dataSource, _condominio, _esercizio, personeRiparto, listaUnitaImmobiliare, _parameters, _impostazioneReportDTO, reportKey, _note);
SetDataSource(document.GetReport(), _impostazioneReportDTO);
}
catch (Exception ex)
{
_log.ErrorFormat("Errore nell'apertura della maschera di anteprima per riparto - {0} - condominio:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), _condominio?.ID.ToString(CultureInfo.InvariantCulture) ?? "<NULL>", Login.Instance.CurrentLogin().Azienda);
throw;
}
}
示例2: AnteprimaReportRiparto
public AnteprimaReportRiparto(IList<ReportRipartizioneBilancioDTO> dataSource, CondominioDTO condominio, EsercizioDTO esercizio, BilancioConsuntivoReportParameters parameters, ImpostazioneReportDTO impostazioneReportDTO)
{
InitializeComponent();
_dataSource = dataSource;
_condominio = condominio;
_esercizio = esercizio;
_parameters = parameters;
_impostazioneReportDTO = impostazioneReportDTO;
Text = $"Riparto {_impostazioneReportDTO.Descrizione}";
try
{
_importoTotale = getBilancioService().GetTotale(dataSource.ToList());
_importoPreventivo = getBilancioService().GetTotalePreventivo(dataSource.ToList());
IReportProvider document;
if(_impostazioneReportDTO.MultiPageOrdered)
document = new RipartoMerge(dataSource, _condominio, _esercizio, _parameters, _impostazioneReportDTO, _importoTotale, _importoPreventivo);
else
document = new RipartoSubreport(dataSource, _condominio, _esercizio, _parameters, _impostazioneReportDTO, _importoTotale, _importoPreventivo);
SetDataSource(document.GetReport(), _impostazioneReportDTO);
}
catch (Exception ex)
{
_log.ErrorFormat("Errore nell'apertura della maschera di anteprima per riparto - {0} - condominio:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), _condominio?.ID.ToString(CultureInfo.InvariantCulture) ?? "<NULL>", Login.Instance.CurrentLogin().Azienda);
Close();
}
}
示例3: Filter
private static IList<SignatureHelpItem> Filter(IList<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;
}
示例4: CalculateTotalScore
/// <summary>
/// Accepts a collection of frames and returns the total score
/// </summary>
/// <param name="scores"></param>
/// <returns></returns>
public int CalculateTotalScore(IList<IFrame> scores)
{
ValidateFrames(scores.ToList());
var totalScore = 0;
scores.ToList().ForEach(sc => totalScore += sc.Score);
return totalScore;
}
示例5: Run
public long Run(IList<int> numbers)
{
long total = 0;
int amount = this.maximum;
int k;
var rest = numbers.ToList();
for (k = 0; k < numbers.Count - 1; k++)
{
int move = this.Decide(amount, rest);
total += (long)move * numbers[k];
amount -= move;
amount += this.reload;
if (amount > this.maximum)
amount = this.maximum;
rest = rest.Skip(1).ToList();
}
total += (long)amount * numbers[k];
return total;
}
示例6: GetToolbarItem
/// <summary>
/// Get the ToolbarItem reference by it's name.
/// </summary>
/// <returns>The ToolbarItem object that references the UIBarButtonInfo.</returns>
/// <param name="items">The list of Items.</param>
/// <param name="title">The button title.</param>
ToolbarItem GetToolbarItem(IList<ToolbarItem> items, string title)
{
if (string.IsNullOrEmpty(title) || items == null)
return null;
return items.ToList().FirstOrDefault(itemData => title.Equals(itemData.Text));
}
示例7: OnCreate
/// <summary>
/// When the activity is created
/// </summary>
/// <param name="bundle">Any data passed to the activity</param>
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
//Allow this inbox to be retrieved by other classes
//This allows the inbox to be updated when a new message arrives
MainActivity.references.Put ("Inbox", this);
SetContentView(Resource.Layout.messaging_inbox);
taskListView = (ListView)FindViewById (Resource.Id.listView);
//Get all the users that this user has had a conversation with
users = MessageRepository.GetMessagedUsers().ToArray<string>();
tasks = new List<Message>();
//Get the most recent message from each user to display in the "main" messaging list
foreach (string s in users)
{
tasks.Add(MessageRepository.GetMostRecentMessageFrom(s));
}
// create our adapter
taskList = new MsgListAdapterInbox(this, users.ToList());
//Hook up our adapter to our ListView
taskListView.Adapter = taskList;
}
示例8: CreatePackage
public Validation CreatePackage(ref Package package, IList<long> items)
{
var val = _validator.ValidateNewPackage(package, null);
var trans = _factory.BuildTransaction("InsertPackage");
try
{
//validate
if (val.IsValid)
{
_repo.Insert(ref package, ref trans);
long packageId = package.Id;
items.ToList().ForEach(i => _itemRepo.SetItemPackage(i, packageId, ref trans));
}
trans.Commit();
}
catch (Exception e)
{
trans.Rollback();
val.AddError(string.Format("Unable to create package: {0}", e.Message));
}
finally
{
trans.Dispose();
}
return val;
}
示例9: OptionsForSyncUp
public static SyncOptions OptionsForSyncUp(IList<string> fieldList, MergeModeOptions mergeMode)
{
var nativeMergeMode = JsonConvert.SerializeObject(mergeMode);
var nativeSyncOptions = SDK.SmartSync.Model.SyncOptions.OptionsForSyncUp(fieldList.ToList(), JsonConvert.DeserializeObject<SDK.SmartSync.Model.SyncState.MergeModeOptions>(nativeMergeMode));
var syncOptions = JsonConvert.SerializeObject(nativeSyncOptions);
return JsonConvert.DeserializeObject<SyncOptions>(syncOptions);
}
示例10: ListController
/// <summary>
/// Initializes a new instance of the <see cref="ListController"/> class.
/// </summary>
/// <param name="list">
/// The list.
/// </param>
/// <param name="dialogTitle">
/// The dialog title.
/// </param>
public ListController(IList<string> list, string dialogTitle)
{
// Clone the list. That way, if the close button is used
// the original list won't be affected.
this.List = new BindingList<string>(list.ToList());
this.Title = dialogTitle;
}
示例11: Execute
public void Execute(IList<IAggregateCommand> commands, int expectedVersion)
{
if (commands.Count == 0)
{
return;
}
// readModelBuilderBus will publish events to a bus that will build read models and then pass events off to
// the real eventBus
var readModelBuilderBus = new ReadModelBuildingEventBus(this.registration.ImmediateReadModels(this.scope), this.eventBus);
// holds the events that were raised from the aggregate and will push them to the read model building bus
var aggregateEvents = new UnitOfWorkEventBus(readModelBuilderBus);
// subscribe to the changes in the aggregate and publish them to aggregateEvents
var aggregateRepo = new AggregateRepository(registration.New, this.scope.GetRegisteredObject<IEventStore>(), scope.GetRegisteredObject<ISnapshotRepository>());
var subscription = aggregateRepo.Changes.Subscribe(aggregateEvents.Publish);
this.scope.Add(new UnitOfWorkDisposable(subscription));
// add them in this order so that aggregateEvents >> readModelBuilderBus >> read model builder >> eventBus
this.scope.Add(aggregateEvents);
this.scope.Add(readModelBuilderBus);
var cmd = new CommandExecutor(aggregateRepo);
cmd.Execute(commands.ToList(), expectedVersion);
// enqueue pending commands
this.EnqueueCommands(this.scope.GetRegisteredObject<IPendingCommandRepository>(), commands);
// enqueue read models to be built - for non-immediate read models
var typeName = AggregateRootBase.GetAggregateTypeDescriptor(registration.AggregateType);
this.EnqueueReadModels(this.scope.GetRegisteredObject<IReadModelQueueProducer>(), typeName, aggregateEvents.GetEvents().Select(x => x.Event).OfType<IAggregateEvent>().ToList());
}
示例12: setupElems
private void setupElems(IList<Profile.ElementComponent> elements)
{
if (elements == null) throw Error.ArgumentNull("elements");
_elements = elements.ToList(); // make a *shallow* copy of the list of elements
OrdinalPosition = null;
}
示例13: UpdateMarkers
public void UpdateMarkers(IList<MediaMarker> markers, bool forceRefresh)
{
var markersHash = markers.ToDictionary(i => i.Id, i => i);
List<MediaMarker> newMarkers;
List<MediaMarker> removedMarkers;
if (forceRefresh)
{
newMarkers = markers.ToList();
removedMarkers = _previousMarkers.Values.ToList();
}
else
{
newMarkers = markers.Where(i => !_previousMarkers.ContainsKey(i.Id)).ToList();
removedMarkers = _previousMarkers.Values.Where(i => !markersHash.ContainsKey(i.Id)).ToList();
}
if (removedMarkers.Any() && MarkersRemoved != null)
{
MarkersRemoved(removedMarkers);
}
if (newMarkers.Any() && NewMarkers != null)
{
NewMarkers(newMarkers);
}
_previousMarkers = markersHash;
}
示例14: GetButtonInfo
private ToolbarItem GetButtonInfo(IList<ToolbarItem> items, string name)
{
if (string.IsNullOrEmpty(name) || items == null)
return null;
return items.ToList().Where(itemData => name.Equals(itemData.Name)).FirstOrDefault();
}
示例15: CompletedItemReviewer
public CompletedItemReviewer(IList<SuspiciousPhrase> basicSuspiciousPhrases)
{
if (basicSuspiciousPhrases == null)
throw new ArgumentNullException(nameof(basicSuspiciousPhrases));
_basicSuspiciousPhrases = basicSuspiciousPhrases.ToList();
}