From 19c2a7515fa11185463c4a1dd05c2eae1a258941 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 15 Jan 2024 23:54:47 +0100 Subject: [PATCH] Add "HasValue" to CS2EventArgs --- CS2GSI/CS2EventArgs.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CS2GSI/CS2EventArgs.cs b/CS2GSI/CS2EventArgs.cs index 8404300..fa58b92 100644 --- a/CS2GSI/CS2EventArgs.cs +++ b/CS2GSI/CS2EventArgs.cs @@ -2,20 +2,22 @@ public class CS2EventArgs : EventArgs { - public object? Value; + private readonly object? _value; + public readonly bool HasValue; public CS2EventArgs(object? value = null) { - this.Value = value; + this._value = value; + this.HasValue = value is not null; } public T? ValueAsOrDefault() { - return Value is T val ? val : default; + return _value is T val ? val : default; } public override string ToString() { - return Value?.ToString() ?? "NoArgs"; + return _value?.ToString() ?? "NoArgs"; } } \ No newline at end of file