Use null propagation

This commit is contained in:
Stepan Goremykin
2023-10-08 01:25:37 +02:00
parent 212976277d
commit fdef9356b9
9 changed files with 20 additions and 59 deletions

View File

@@ -337,10 +337,7 @@ namespace Rssdp
protected virtual void OnDeviceAdded(SsdpEmbeddedDevice device)
{
var handlers = this.DeviceAdded;
if (handlers != null)
{
handlers(this, new DeviceEventArgs(device));
}
handlers?.Invoke(this, new DeviceEventArgs(device));
}
/// <summary>
@@ -352,10 +349,7 @@ namespace Rssdp
protected virtual void OnDeviceRemoved(SsdpEmbeddedDevice device)
{
var handlers = this.DeviceRemoved;
if (handlers != null)
{
handlers(this, new DeviceEventArgs(device));
}
handlers?.Invoke(this, new DeviceEventArgs(device));
}
}
}