27 lines
885 B
C#
27 lines
885 B
C#
using System;
|
|
|
|
namespace EonaCat.WebSockets.Extensions;
|
|
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
|
// See the LICENSE file or go to https://EonaCat.com/License for full license details.
|
|
|
|
public class AbsentableValueParameter<T> : ExtensionParameter
|
|
{
|
|
public AbsentableValueParameter(string name, Func<string, bool> valueValidator, T defaultValue)
|
|
: base(name)
|
|
{
|
|
if (valueValidator == null)
|
|
{
|
|
throw new ArgumentNullException("valueValidator");
|
|
}
|
|
|
|
ValueValidator = valueValidator;
|
|
DefaultValue = defaultValue;
|
|
}
|
|
|
|
public override ExtensionParameterType ParameterType =>
|
|
ExtensionParameterType.Single | ExtensionParameterType.Valuable;
|
|
|
|
public Func<string, bool> ValueValidator { get; private set; }
|
|
|
|
public T DefaultValue { get; private set; }
|
|
} |