From 1be9ffbf8acbc9770f2d5b67c961fb60e49e5ec5 Mon Sep 17 00:00:00 2001 From: TheJoKlLa Date: Tue, 31 Jan 2023 14:47:48 +0100 Subject: [PATCH] Fixed: Nullable Eventhandler --- Capnp.Net.Runtime/Rpc/TcpRpcClient.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs b/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs index 2e735d5..869d135 100644 --- a/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs +++ b/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs @@ -274,7 +274,7 @@ namespace Capnp.Rpc /// /// State of Connection has changed /// - public event EventHandler ConnectionStateChanged; + public event EventHandler? ConnectionStateChanged; private ConnectionState _State = ConnectionState.Initializing; @@ -295,13 +295,9 @@ namespace Capnp.Rpc }; _State = value; - EventHandler eventHandler = ConnectionStateChanged; - if(eventHandler != null) - { - eventHandler(this, args); - } + ConnectionStateChanged?.Invoke(this, args); } - } + } /// /// Gets the number of RPC protocol messages sent by this client so far.