Add various optimizations and cleanups (#1114)

* Change all Select(... as ...) to OfType

* Add changes according to 194a8aa427
This commit is contained in:
Still Hsu
2018-08-31 05:36:44 +08:00
committed by Christopher F
parent a2d8800115
commit 82cfdffc65
46 changed files with 131 additions and 135 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -28,7 +28,7 @@ namespace Discord.WebSocket
_orderedMessages.Enqueue(message.Id);
while (_orderedMessages.Count > _size && _orderedMessages.TryDequeue(out ulong msgId))
_messages.TryRemove(msgId, out SocketMessage msg);
_messages.TryRemove(msgId, out _);
}
}

View File

@@ -12,12 +12,12 @@ namespace Discord.WebSocket
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketUserMessage : SocketMessage, IUserMessage
{
private readonly List<SocketReaction> _reactions = new List<SocketReaction>();
private bool _isMentioningEveryone, _isTTS, _isPinned;
private long? _editedTimestampTicks;
private ImmutableArray<Attachment> _attachments;
private ImmutableArray<Embed> _embeds;
private ImmutableArray<ITag> _tags;
private List<SocketReaction> _reactions = new List<SocketReaction>();
public override bool IsTTS => _isTTS;
public override bool IsPinned => _isPinned;