csharp.libraries.generichost.Option.mustache Maven / Gradle / Ivy
//
{{>partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
namespace {{packageName}}.{{clientPackage}}
{
///
/// A wrapper for operation parameters which are not required
///
public struct Option
{
///
/// The value to send to the server
///
public TType Value { get; }
///
/// When true the value will be sent to the server
///
internal bool IsSet { get; }
///
/// A wrapper for operation parameters which are not required
///
///
public Option(TType value)
{
IsSet = true;
Value = value;
}
///
/// Implicitly converts this option to the contained type
///
///
public static implicit operator TType(Option option) => option.Value;
///
/// Implicitly converts the provided value to an Option
///
///
public static implicit operator Option(TType value) => new Option(value);
}
}