using System;
using System.Text;
namespace MPF.Frontend
{
///
/// String wrapper for event arguments
///
public class StringEventArgs : EventArgs
{
///
/// String represented by the event arguments
///
private readonly string _value;
///
/// Constructor for string values
///
public StringEventArgs(string? value)
{
_value = value ?? string.Empty;
}
///
/// Constructor for StringBuilder values
///
public StringEventArgs(StringBuilder? value)
{
_value = value?.ToString() ?? string.Empty;
}
///
/// Event arguments are just the value of the string contained within
///
public static implicit operator string(StringEventArgs args) => args._value;
///
/// Event arguments are just the value of the string contained within
///
public static implicit operator StringBuilder(StringEventArgs args) => new(args._value);
///
/// Event arguments are just the value of the string contained within
///
public static implicit operator StringEventArgs(string? str) => new(str);
///
/// Event arguments are just the value of the string contained within
///
public static implicit operator StringEventArgs(StringBuilder? sb) => new(sb);
}
}