Expose Live.Detach() method for ease of use

This commit is contained in:
Dean Herbert 2021-01-11 19:28:07 +09:00
parent dd50b5870e
commit d810af82ec
1 changed files with 6 additions and 1 deletions

View File

@ -68,6 +68,11 @@ private T getThreadLocalValue()
/// </summary>
public T Get() => threadValues.Value;
/// <summary>
/// Retrieve a detached copy of the data.
/// </summary>
public T Detach() => Get().Detach();
/// <summary>
/// Wrap a property of this instance as its own live access object.
/// </summary>
@ -88,7 +93,7 @@ public void PerformUpdate(Action<T> perform)
}
public static implicit operator T?(Live<T>? wrapper)
=> wrapper?.Get().Detach();
=> wrapper?.Detach() ?? null;
public static implicit operator Live<T>(T obj) => obj.WrapAsUnmanaged();