Files
tbd-station-14/Content.Server/DeviceNetwork/Metadata.cs
2021-03-16 15:50:20 +01:00

21 lines
539 B
C#

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Content.Server.GameObjects.EntitySystems.DeviceNetwork
{
public class Metadata : Dictionary<string, object>
{
public bool TryParseMetadata<T>(string key, [NotNullWhen(true)] out T? data)
{
if (TryGetValue(key, out var value) && value is T typedValue)
{
data = typedValue;
return true;
}
data = default;
return false;
}
}
}