Add various optimizations and cleanups (#1114)
* Change all Select(... as ...) to OfType
* Add changes according to 194a8aa427
This commit is contained in:
@@ -168,7 +168,7 @@ namespace Discord.Rest
|
||||
public async Task<IReadOnlyCollection<RestTextChannel>> GetTextChannelsAsync(RequestOptions options = null)
|
||||
{
|
||||
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
|
||||
return channels.Select(x => x as RestTextChannel).Where(x => x != null).ToImmutableArray();
|
||||
return channels.OfType<RestTextChannel>().ToImmutableArray();
|
||||
}
|
||||
public async Task<RestVoiceChannel> GetVoiceChannelAsync(ulong id, RequestOptions options = null)
|
||||
{
|
||||
@@ -178,12 +178,12 @@ namespace Discord.Rest
|
||||
public async Task<IReadOnlyCollection<RestVoiceChannel>> GetVoiceChannelsAsync(RequestOptions options = null)
|
||||
{
|
||||
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
|
||||
return channels.Select(x => x as RestVoiceChannel).Where(x => x != null).ToImmutableArray();
|
||||
return channels.OfType<RestVoiceChannel>().ToImmutableArray();
|
||||
}
|
||||
public async Task<IReadOnlyCollection<RestCategoryChannel>> GetCategoryChannelsAsync(RequestOptions options = null)
|
||||
{
|
||||
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
|
||||
return channels.Select(x => x as RestCategoryChannel).Where(x => x != null).ToImmutableArray();
|
||||
return channels.OfType<RestCategoryChannel>().ToImmutableArray();
|
||||
}
|
||||
|
||||
public async Task<RestVoiceChannel> GetAFKChannelAsync(RequestOptions options = null)
|
||||
|
||||
Reference in New Issue
Block a user