Refactor where clause
This commit is contained in:
parent
5d493c7001
commit
95e5e35b6a
1 changed files with 2 additions and 2 deletions
|
@ -17,8 +17,8 @@ public class PacketForwardingService
|
|||
// Get all types that implement IPacket and have a PacketIdAttribute
|
||||
_packets = assembly.GetTypes()
|
||||
.Select(x => (attr: x.GetCustomAttribute<PacketIdAttribute>(), ctor: x.GetConstructor(Type.EmptyTypes)))
|
||||
.Where(x => x.attr != null && x.ctor != null && x.GetType().IsAssignableTo(typeof(IPacket)) &&
|
||||
x.GetType().IsClass)
|
||||
.Where(x => x.GetType().IsAssignableTo(typeof(IPacket)) && x.GetType().IsClass)
|
||||
.Where(x => x.attr != null && x.ctor != null)
|
||||
.ToImmutableDictionary(x => x.attr!.PacketId, x => x.ctor)!;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue