// Copyright Epic Games, Inc. All Rights Reserved.
namespace EpicGames.Core
{
///
/// Explicitly boxes a value type, allowing it to be passed by reference to (and modified in) an async method.
///
///
public class Boxed
{
///
/// The struct value
///
public T Value { get; set; }
///
/// Default constructor
///
/// The value to copy
public Boxed(T value)
{
Value = value;
}
///
public override string? ToString()
{
return Value?.ToString();
}
///
/// Implicit conversion of a boxed value to value type
///
///
public static implicit operator T(Boxed boxed)
{
return boxed.Value;
}
///
/// Implicit conversion of a boxed value to value type
///
///
public static implicit operator Boxed(T value)
{
return new Boxed(value);
}
}
}