1
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
{
|
||||
bool Allow { get; set; }
|
||||
T Value { get; set; }
|
||||
T IfNotAllow(T value);
|
||||
}
|
||||
[System.Serializable]
|
||||
public class Optional<T> : IOptional<T>
|
||||
@@ -29,6 +30,11 @@
|
||||
set=>this.value=value;
|
||||
}
|
||||
|
||||
public T IfNotAllow(T other)
|
||||
{
|
||||
return Allow ? Value : other;
|
||||
}
|
||||
|
||||
public void SetValueThenAllow(T newValue)
|
||||
{
|
||||
value = newValue;
|
||||
|
Reference in New Issue
Block a user