System.Collections.Generic.IEnumerable.ToList()

Here are the examples of the csharp api class System.Collections.Generic.IEnumerable.ToList() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: TraceLab
Source File: LayeredTopologicalSortAlgorithm.cs
protected IList<TVertex> GetSources( IEnumerable<TVertex> vertices )
		{
			return ( from v in vertices
			         where tmpGraph.IsInEdgesEmpty( v )
			         select v ).ToList();
		}

2. Example

Project: Command-R
Source File: Extensions.cs
public static PagedList<T> ToPagedList<T>(this IEnumerable<T> items, int pageNumber, int totalItems)
        {
            return new PagedList<T>
            {
                PageNumber = pageNumber,
                Items = items.ToList(),
                TotalItems = totalItems,
            };
        }

3. Example

Project: concordion-net
Source File: VerifyRowsListenerTest.cs
public List<String> getGeorgeAndRingo()
        {
            var result = new string[] {"George Harrison", "Ringo Starr"};
            return result.ToList();
        }

4. Example

Project: confluent-kafka-dotnet
Source File: Consumer.cs
public void Assign(IEnumerable<TopicPartitionOffset> partitions)
            => kafkaHandle.Assign(partitions.ToList());

5. Example

Project: GridDomain
Source File: Compare.cs
public static CompareLogic Ignore(params string[] members)
        {
            return new CompareLogic(
                new ComparisonConfig
                {
                    MembersToIgnore = members.ToList()
                } );
        }

6. Example

Project: ContinuousTests
Source File: Linq.cs
public static T [] ToArray<T> (this IEnumerable<T> self)
		{
			return self.ToList ().ToArray ();
		}

7. Example

Project: FluentCache
Source File: CacheStrategy.cs
internal virtual void CopyFrom(CacheStrategy other)
        {
            this.Expiration = other.Expiration;
            this.Region = other.Region;
            this.Parameters = other.Parameters == null ? null : other.Parameters.ToList();
        }

8. Example

Project: FluentCache
Source File: CacheStrategyIncomplete.cs
public CacheStrategyIncomplete WithParameters(params object[] parameters)
        {
            this.Parameters = parameters.ToList();
            return this;
        }

9. Example

Project: Hypermedia
Source File: ContractBuilder.cs
IContract IContractBuilder.CreateContract()
        {
            _contract.Fields = _fields.ToList();

            return _contract;
        }

10. Example

Project: couchbase-net-client
Source File: SpatialViewQuery.cs
public ISpatialViewQuery StartRange(params double?[] startRange)
        {
            _startRange = startRange.ToList();
            return this;
        }

11. Example

Project: couchbase-net-client
Source File: SpatialViewQuery.cs
public ISpatialViewQuery EndRange(params double?[] endRange)
        {
            _endRange = endRange.ToList();
            return this;
        }

12. Example

Project: GameCloud.Orleans
Source File: Inventory.cs
public List<string> GetAllOwnedSkus()
        {
            return _purchaseMap.Keys.ToList<string>();
        }

13. Example

Project: GameCloud.Orleans
Source File: Inventory.cs
public List<Purchase> GetAllPurchases()
        {
            return _purchaseMap.Values.ToList<Purchase>();
        }

14. Example

Project: GameCloud.Orleans
Source File: Inventory.cs
public List<SkuDetails> GetAllAvailableSkus()
        {
            return _skuMap.Values.ToList();
        }

15. Example

Project: unity-arkit-portal
Source File: UnityARAnchorManager.cs
public List<ARPlaneAnchorGameObject> GetCurrentPlaneAnchors()
		{
			return planeAnchorMap.Values.ToList ();
		}

16. Example

Project: SF-Boilerplate
Source File: SuccessOrErrors.cs
public ISuccessOrErrors SetErrors(IEnumerable<ValidationResult> errors)
        {
            _localErrors = errors.ToList();
            _localSuccessMessage = string.Empty;
            return this;
        }

17. Example

Project: Glimpse.Nancy
Source File: GlimpseStartup.cs
private void InitializeGlimpse(NancyContext ctx)
        {
            if (GlimpseRuntime.IsAvailable) return;

            lock (InitLock)
            {
                if (GlimpseRuntime.IsAvailable) return;

                GlimpseRuntime.Initializer.AddInitializationMessage(LoggingLevel.Info, "Initializing Glimpse.Nancy Runtime");

                var config = new Configuration(
                    new NancyEndpointConfiguration(ctx),
                    new InMemoryPersistenceStore(new DictionaryDataStoreAdapter(ServerItemsCollection))
                );
                config.Tabs = this.tabs.ToList();
                config.Inspectors = this.inspectors.ToList();

                GlimpseRuntime.Initializer.Initialize(config);
            }
        }

18. Example

Project: Portable.Xaml
Source File: Extensions.cs
public static IList<T> ToReadOnly<T>(this IEnumerable<T> enumerable)
		{
			return new ReadOnlyCollection<T>(enumerable.ToList());
		}

19. Example

Project: naps2
Source File: ScannedImageList.cs
public IEnumerable<int> RotateFlip(IEnumerable<int> selection, RotateFlipType rotateFlipType)
        {
            foreach (int i in selection)
            {
                Images[i].AddTransform(new RotationTransform(rotateFlipType));
                Images[i].SetThumbnail(ThumbnailRenderer.RenderThumbnail(Images[i]));
            }
            return selection.ToList();
        }

20. Example

Project: naps2
Source File: ScannedImageList.cs
public IEnumerable<int> Reverse(IEnumerable<int> selection)
        {
            var selectionList = selection.ToList();
            int pairCount = selectionList.Count / 2;

            // Swap pairs in the selection, excluding the middle element (if the total count is odd)
            for (int i = 0; i < pairCount; i++)
            {
                int x = selectionList[i];
                int y = selectionList[selectionList.Count - i - 1];
                var temp = Images[x];
                Images[x] = Images[y];
                Images[y] = temp;
            }

            RecoveryImage.Refresh(Images);

            // Selection stays the same, so is easy to maintain
            return selectionList;
        }

21. Example

Project: naps2
Source File: ScannedImageList.cs
public IEnumerable<int> ResetTransforms(IEnumerable<int> selection)
        {
            foreach (ScannedImage img in Images.ElementsAt(selection))
            {
                img.ResetTransforms();
                img.SetThumbnail(ThumbnailRenderer.RenderThumbnail(img));
            }
            return selection.ToList();
        }

22. Example

Project: naps2
Source File: FDesktop.cs
private void tsPrint_Click(object sender, EventArgs e)
        {
            if (appConfigManager.Config.HidePrintButton)
            {
                return;
            }

            if (scannedImagePrinter.PromptToPrint(imageList.Images, SelectedImages.ToList()))
            {
                changeTracker.HasUnsavedChanges = false;
            }
        }

23. Example

Project: CypherCore
Source File: RealmManager.cs
public List<Realm> GetRealms() { return _realms.Values.ToList(); }

24. Example

Project: CypherCore
Source File: CommandManager.cs
public static List<ChatCommand> GetCommands()
        {
            return _commands.Values.ToList();
        }

25. Example

Project: CypherCore
Source File: Grid.cs
public void Visit(Visitor visitor)
        {
            switch (visitor._mask)
            {
                case GridMapTypeMask.AllGrid:
                    visitor.Visit(_container.gameObjects.ToList());
                    visitor.Visit(_container.creatures.ToList());
                    visitor.Visit(_container.dynamicObjects.ToList());
                    visitor.Visit(_container.corpses.ToList());
                    visitor.Visit(_container.areaTriggers.ToList());
                    visitor.Visit(_container.conversations.ToList());
                    visitor.Visit(_container.worldObjects.ToList());
                    break;
                case GridMapTypeMask.AllWorld:
                    visitor.Visit(_objects.players);
                    visitor.Visit(_objects.creatures.ToList());
                    visitor.Visit(_objects.corpses.ToList());
                    visitor.Visit(_objects.dynamicObjects.ToList());
                    visitor.Visit(_objects.worldObjects.ToList());
                    break;
                default:
                    Log.outError(LogFilter.Server, "{0} called Visit with Unknown Mask {1}.", visitor.ToString(), visitor._mask);
                    break;
            }
        }

26. Example

Project: CypherCore
Source File: GridNotifiers.cs
public override void Visit(ICollection<WorldObject> objs)
        {
            foreach (var obj in objs.ToList())
            {
                if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse))
                    continue;

                if (obj.IsInWorld)
                    obj.Update(i_timeDiff);
            }
        }

27. Example

Project: CypherCore
Source File: MapManager.cs
public void Update(uint diff)
        {
            i_timer.Update(diff);
            if (!i_timer.Passed())
                return;

            var time = (uint)i_timer.GetCurrent();
            foreach (var map in i_maps.Values.ToList())
            {
                //if (!m_updater)
                //m_updater.Enqueue(map, (uint)i_timer.GetCurrent());
                //else
                map.Update(time);
            }

            //List<System.Threading.Tasks.Task> tasks = new List<System.Threading.Tasks.Task>();
            //foreach (var map in i_maps.Values.ToList())
            {
                //tasks.Add(System.Threading.Tasks.Task.Factory.StartNew(() => map.Update(time)));
            }
            //System.Threading.Tasks.Task.WaitAll(tasks.ToArray());
            //if (!m_updater)
               // m_updater.Wait();

            foreach (var map in i_maps.ToList())
                map.Value.DelayedUpdate(time);

            i_timer.SetCurrent(0);
        }

28. Example

Project: CypherCore
Source File: MapManager.cs
public uint GetNumInstances()
        {
            uint ret = 0;
            foreach (var pair in i_maps.ToList())
            {
                Map map = pair.Value;
                if (!map.Instanceable())
                    continue;
                var maps = ((MapInstanced)map).GetInstancedMaps();
                foreach (var imap in maps)
                    if (imap.Value.IsDungeon())
                        ret++;
            }
            return ret;
        }

29. Example

Project: CypherCore
Source File: ScriptManager.cs
public List<TValue> GetStorage()
        {
            return ScriptMap.Values.ToList();
        }

30. Example

Project: CypherCore
Source File: WorldManager.cs
public List<WorldSession> GetAllSessions()
        {
            return m_sessions.Values.ToList();
        }

31. Example

Project: LinqToSolr
Source File: LinqToSolrQueriable.cs
public static IEnumerable<IGrouping<string, TKey>> GroupByFacets<TSource, TKey>(this IQueryable<TSource> enumerable, int facetsLimit, params Expression<Func<TSource, TKey>>[] expression)
#endif
        {
            var query = enumerable as LinqToSolrQueriable<TSource>;
            if (query == null) throw new ArgumentException("GroupBySolr must be invoked as SolrQueryable extension");
            var service = ((LinqToSolrProvider)query.Provider).Service;
            service.CurrentQuery = service.CurrentQuery ?? new LinqToSolrQuery();
            foreach (var expr in expression)
            {
                service.CurrentQuery.AddFacet(expr);
            }
            var oldStart = service.Configuration.Start;
            var oldTake = service.Configuration.Take;

            service.Configuration.Start = 0;
            service.Configuration.Take = 0;
            if (facetsLimit > 0)
            {
                service.Configuration.FacetsLimit = facetsLimit;
            }
            var result = query.ToList();

            service.Configuration.Start = oldStart;
            service.Configuration.Take = oldTake;

            var items = service.LastResponse.Facets.Fields;
            var groups = items.SelectMany(x => x.Value.Select(k => new { x.Key, Value = k }))
                .ToLookup(x => x.Key, x => (TKey)x.Value);
            return groups;
        }

32. Example

Project: async-dolls
Source File: QueuedTaskScheduler.cs
protected override IEnumerable<Task> GetScheduledTasks()
            {
                return _workItems.ToList();
            }

33. Example

Project: mycouch
Source File: FindParametersConfigurator.cs
public virtual FindParametersConfigurator Sort(params SortableField[] fields)
        {
            EnsureArg.HasItems(fields, nameof(fields));

            Parameters.Sort = fields.ToList();

            return this;
        }

34. Example

Project: mycouch
Source File: FindParametersConfigurator.cs
public virtual FindParametersConfigurator Fields(params string[] fields)
        {
            EnsureArg.HasItems(fields, nameof(fields));

            Parameters.Fields = fields.ToList();

            return this;
        }

35. Example

Project: mycouch
Source File: IndexParametersConfigurator.cs
public virtual IndexParametersConfigurator Fields(params SortableField[] fields)
        {
            EnsureArg.HasItems(fields, nameof(fields));

            Parameters.Fields = fields.ToList();

            return this;
        }

36. Example

Project: XrmUnitTest
Source File: IndexBase.cs
public void Rebuild()
        {
            if (this.Table.PrimaryKeyIndex == null)
            {
                // Primary index has not been initialized yet
                // Probably we are in the constructor of the Table class now
                return;
            }

            IEnumerable<TEntity> tableData = this.Table.PrimaryKeyIndex.SelectAll();

            if (this.Table.PrimaryKeyIndex == this)
            {
                // Store the current data, if the primary index is being rebuilt
                tableData = tableData.ToList();
            }

            this.DataStructure.Clear();

            foreach (TEntity entity in tableData)
            {
                this.DataStructure.Insert(this.KeyInfo.SelectKey(entity), entity);
            }
        }

37. Example

Project: dataexplorer
Source File: GridLineFactory.cs
public IEnumerable<AxisGridLine> Create(Type type, AxisMap map, IEnumerable<object> values, double lower, double upper)
        {
            if (type == typeof(Boolean))
                return _booleanFactory.Create(map, lower, upper);

            if (type == typeof(DateTime))
                return _dateTimeFactory.Create(map, lower, upper);

            if (type == typeof(Double))
                return _floatFactory.Create(map, lower, upper);

            if (type == typeof(Int32))
                return _integerFactory.Create(map, lower, upper);

            if (type == typeof(String))
                return _stringFactory.Create(map, values.ToList(), lower, upper);

            return new List<AxisGridLine>();
        }

38. Example

Project: dataexplorer
Source File: ProjectSerializer.cs
private static Project CreateProject(
            IEnumerable<Source> sources, 
            IEnumerable<Column> columns, 
            IEnumerable<Row> rows, 
            IEnumerable<Filter> filters,
            IEnumerable<View> views)
        {
            var project = new Project()
            {
                Sources = sources.ToList(),
                Columns = columns.ToList(),
                Rows = rows.ToList(),
                Filters = filters.ToList(),
                Views = views.ToList()
            };
            return project;
        }

39. Example

Project: dataexplorer
Source File: DataContext.cs
public Project GetProject()
        {
            return new Project()
            {
                Sources = _sources.Values.ToList(),
                Columns = _columns.ToList(),
                Rows = _rows.ToList(),
                Filters = _filters.ToList(),
                Views = _views.Values.ToList()
            };
        }

40. Example

Project: PolyglotUnity
Source File: LocalizationImporter.cs
public static List<string> GetKeys()
        {
            return languageStrings.Keys.ToList();
        }

41. Example

Project: Podcasts
Source File: DownloadsPage.xaml.cs
private void AddToPlaylistButton_Click(object sender, RoutedEventArgs e)
        {
            Playlist.CurrentPlaylist.AddEpisodes(downloads.ToList());
        }

42. Example

Project: Podcasts
Source File: LibraryPage.xaml.cs
private void AddAllEpisodesToPlaylistMenu_OnClick(object sender, RoutedEventArgs e)
        {
            IEnumerable<Episode> source = null;
            switch (LocalSettings.Instance.PodcastsFilter)
            {
                case 2:
                    source = Library.Podcasts.SelectMany(p => p.Episodes).Where(ep => !ep.IsPlayed).OrderBy(ep => ep.PublicationDate);
                    break;
                case 3:
                    source = Library.Podcasts.SelectMany(p => p.Episodes).Where(ep => !ep.IsPlayed).OrderByDescending(ep => ep.PublicationDate);
                    break;
            }

            Playlist.CurrentPlaylist.AddEpisodes(source.ToList());            
        }

43. Example

Project: mobiledb
Source File: MobileDB.cs
public static IEnumerable<Type> FileSystems()
        {
            lock (Sync)
            {
                return SupportedFileSystems.ToList();
            }
        }

44. Example

Project: BetterCMS
Source File: DefaultBlogService.cs
protected void AddDefaultAccessRules(BlogPost blogPost, IPrincipal principal, Page masterPage)
        {
            IEnumerable<IAccessRule> accessRules;

            if (masterPage != null)
            {
                accessRules = masterPage.AccessRules;
            }
            else
            {
                accessRules = accessControlService.GetDefaultAccessList(principal);
            }

            accessControlService.UpdateAccessControl(blogPost, accessRules.ToList());
        }

45. Example

Project: BetterCMS
Source File: DefaultPageCloneService.cs
private void AddAccessRules(PageProperties newPage, IEnumerable<IAccessRule> userAccess)
        {
            if (cmsConfiguration.Security.AccessControlEnabled)
            {
                accessControlService.UpdateAccessControl(newPage, userAccess != null ? userAccess.ToList() : new List<IAccessRule>());
            }
            else
            {
                if (userAccess == null)
                {
                    return;
                }

                newPage.AccessRules = new List<AccessRule>();
                foreach (var rule in userAccess)
                {
                    newPage.AccessRules.Add(new AccessRule
                    {
                        Identity = rule.Identity,
                        AccessLevel = rule.AccessLevel,
                        IsForRole = rule.IsForRole
                    });
                }
            }
        }

46. Example

Project: DevExpress.Mvvm.Free
Source File: ListAdapter.cs
int SetSubMap<U>(IList<U> sublist, IEnumerable<int> map) {
                var mappedSublist = sublist as IMappedList;
                if(mappedSublist == null)
                    return 0;
                mappedSublist.Map = map.ToList();
                return sublist.Count;
            }

47. Example

Project: devicehive-.net
Source File: AuthenticationManager.cs
public IList<AuthenticationProviderInfo> GetProviders()
        {
            return _providers.Values.ToList();
        }

48. Example

Project: Dopamine
Source File: AppearanceService.cs
public List<ColorScheme> GetColorSchemes()
        {
            return this.colorSchemes.ToList();
        }

49. Example

Project: LinqStatistics
Source File: EnumerableStatsMedian.cs
public static double Median(this IEnumerable<int> source)
        {
            if (source == null)
                throw new ArgumentNullException("source");

            var sortedList = (from number in source
                             orderby number
                             select (double)number).ToList();

            int count = sortedList.Count;
            int itemIndex = count / 2;

            if (count % 2 == 0)
            {
                // Even number of items.
                return (sortedList[itemIndex] + sortedList[itemIndex - 1]) / (double)2;
            }

            // Odd number of items.
            return sortedList[itemIndex];
        }

50. Example

Project: LinqStatistics
Source File: EnumerableStatsMedian.cs
public static double Median(this IEnumerable<long> source)
        {
            if (source == null)
                throw new ArgumentNullException("source");

            var sortedList = (from number in source
                             orderby number
                             select (double)number).ToList();

            int count = sortedList.Count;
            int itemIndex = count / 2;

            if (count % 2 == 0)
            {
                // Even number of items.
                return (sortedList[itemIndex] + sortedList[itemIndex - 1]) / (double)2;
            }

            // Odd number of items.
            return sortedList[itemIndex];
        }