本文整理汇总了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);
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}