当前位置: 首页>>代码示例>>C#>>正文


C# List.ToReadOnlyCollection方法代码示例

本文整理汇总了C#中List.ToReadOnlyCollection方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToReadOnlyCollection方法的具体用法?C# List.ToReadOnlyCollection怎么用?C# List.ToReadOnlyCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在List的用法示例。


在下文中一共展示了List.ToReadOnlyCollection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateInstallEvents

 public void GenerateInstallEvents()
 {
     //TEMP: this is really part of the extension manager's job. an extension
     // install event is being simulated here on each web app startup
     var enabled = new List<ExtensionEntry>();
     foreach (var extension in _extensionManager.ActiveExtensions_Obsolete()) {
         var context = new ExtensionEventContext {
                                                     Extension = extension,
                                                     EnabledExtensions = enabled.ToReadOnlyCollection(),
                                                 };
         _extensionEvents.Invoke(x => x.Enabling(context), Logger);
         enabled.Add(extension);
         context.EnabledExtensions = enabled.ToReadOnlyCollection();
         _extensionEvents.Invoke(x => x.Enabled(context), Logger);
     }
 }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:16,代码来源:HackInstallationGenerator.cs

示例2: GetAllLinks

        public ReadOnlyCollection<ExternalLink> GetAllLinks()
        {
            const int count = 50;
            var i = 0;
            var allExternalLinks = new List<ExternalLink>();

            do
            {
                var currentLinks = _fave.GetLinks(count, i * count);
                if (currentLinks != null) allExternalLinks.AddRange(currentLinks);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return allExternalLinks.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:FaveCategoryExtended.cs

示例3: GetAll

        public ReadOnlyCollection<User> GetAll(long uid, ProfileFields fields = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
        {
            const int count = 50;
            var i = 0;
            var result = new List<User>();

            do
            {
                var currentItems = _friends.Get(uid, fields, count, i * count, order, nameCase, listId);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:FriendsCategoryExtended.cs

示例4: GetAll

        public ReadOnlyCollection<Document> GetAll(long? owner_id = null)
        {
            const int count = 50;
            var i = 0;
            var result = new List<Document>();

            do
            {
                var currentItems = _docs.Get(count, i * count, owner_id);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:DocsCategoryExtended.cs

示例5: GetAllCities

        public ReadOnlyCollection<City> GetAllCities(int countryId, int? regionId = null, string query = "", bool? needAll = false)
        {
            const int count = 1000;
            var i = 0;
            var result = new List<City>();

            do
            {
                var currentItems = _database.GetCities(countryId, regionId, query, needAll, count, i * count);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:DatabaseCategoryExtended.cs

示例6: GetAllBanned

        public ReadOnlyCollection<User> GetAllBanned(long groupId)
        {
            const int count = 200;
            var i = 0;
            var result = new List<User>();

            do
            {
                var currentItems = _groups.GetBanned(groupId, count, i * count);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:GroupsCategoryExtended.cs

示例7: GetAll

        public ReadOnlyCollection<Group> GetAll(long uid, bool extended = false, GroupsFilters filters = null, GroupsFields fields = null)
        {
            const int count = 1000;
            var i = 0;
            var result = new List<Group>();

            do
            {
                var currentItems = _groups.Get(uid, extended, filters, fields, i * count, count);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:GroupsCategoryExtended.cs

示例8: GetAll

        public ReadOnlyCollection<Video> GetAll(long? ownerId = null, long? albumId = null, VideoWidth width = VideoWidth.Medium160, bool extended = false)
        {
            const int count = 200;
            var i = 0;
            var result = new List<Video>();

            do
            {
                var currentItems = _video.Get(ownerId, albumId, width, count, i * count, extended);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:VideoCategoryExtended.cs

示例9: GetAllPhotos

        public ReadOnlyCollection<Photo> GetAllPhotos()
        {
            const int count = 50;
            var i = 0;
            var allPhotos = new List<Photo>();

            do
            {
                var currentPhotos = _fave.GetPhotos(count, i * count);
                if (currentPhotos != null) allPhotos.AddRange(currentPhotos);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return allPhotos.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:FaveCategoryExtended.cs

示例10: GetAll

        public ReadOnlyCollection<Audio> GetAll(long uid, out User user, long? albumId = null, IEnumerable<long> aids = null)
        {
            const int count = 6000;
            var i = 0;
            var result = new List<Audio>();

            do
            {
                var currentItems = _audio.Get(uid, out user, albumId, aids, count, i * count);
                if (currentItems != null) result.AddRange(currentItems);
            } while ((++i * count < (_vk.CountFromLastResponse ?? 0)) && (i * count < 6000));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:AudioCategoryExtended.cs

示例11: GetAllFollowers

        public ReadOnlyCollection<User> GetAllFollowers(long? userId = null, ProfileFields fields = null, NameCase nameCase = null)
        {
            const int count = 1000;
            var i = 0;
            var result = new List<User>();

            do
            {
                var currentItems = _users.GetFollowers(userId, count, i * count, fields, nameCase);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:14,代码来源:UsersCategoryExtended.cs

示例12: GetAllBanned

        public IEnumerable<User> GetAllBanned()
        {
            const int count = 200;
            var i = 0;
            var result = new List<User>();

            do
            {
                int total;
                var currentItems = _account.GetBanned(out total, i * count, count);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:15,代码来源:AccountCategoryExtended.cs

示例13: GetAll

        public ReadOnlyCollection<Post> GetAll(long ownerId, WallFilter filter = WallFilter.All)
        {
            const int count = 100;
            var i = 0;
            var allPosts = new List<Post>();

            do
            {
                int totalCount;
                var currentPosts = _wall.Get(ownerId, out totalCount, count, i * count, filter);
                if (currentPosts != null) allPosts.AddRange(currentPosts);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return allPosts.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:15,代码来源:WallCategoryExtended.cs

示例14: VisitMethodDefinitionExpression

        protected override Expression VisitMethodDefinitionExpression(MethodDefinitionExpression method)
        {
            var methodName = method.Name.ToCamelCase();

            var body = new Expression[]
            {
                Expression.Return(Expression.Label(), Expression.Constant(null)).ToStatement()
            };

            var responseType = ObjectiveBinderHelpers.GetWrappedResponseType(this.CodeGenerationContext, method.ReturnType);

            var newParameters = new List<Expression>(method.Parameters)
            {
                FickleExpression.Parameter(new FickleDelegateType(typeof(void), new FickleParameterInfo(responseType, "response")), "callback")
            };

            return new MethodDefinitionExpression(methodName, newParameters.ToReadOnlyCollection(), typeof(void), Expression.Block(body), true, null);
        }
开发者ID:techpub,项目名称:Fickle,代码行数:18,代码来源:GatewayHeaderExpressionBinder.cs

示例15: GetAll

        public ReadOnlyCollection<Message> GetAll(
            MessageType type,
            out int totalCount,
            TimeSpan? timeOffset = null,
            MessagesFilter? filter = null,
            int? previewLength = null,
            long? lastMessageId = null)
        {
            const int count = 200;
            var i = 0;
            var result = new List<Message>();

            do
            {
                var currentItems = _messages.Get(type, out totalCount, count, i * count, timeOffset, filter, previewLength, lastMessageId);
                if (currentItems != null) result.AddRange(currentItems);
            } while (++i * count < (_vk.CountFromLastResponse ?? 0));

            return result.ToReadOnlyCollection();
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:20,代码来源:MessagesCategoryExtended.cs


注:本文中的List.ToReadOnlyCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。