namespace CryptoExchange.Net.Converters.MessageParsing
{
///
/// Node accessor
///
public readonly struct NodeAccessor
{
///
/// Index
///
public int? Index { get; }
///
/// Property name
///
public string? Property { get; }
///
/// Type (0 = int, 1 = string, 2 = prop name)
///
public int Type { get; }
private NodeAccessor(int? index, string? property, int type)
{
Index = index;
Property = property;
Type = type;
}
///
/// Create an int node accessor
///
///
///
public static NodeAccessor Int(int value) { return new NodeAccessor(value, null, 0); }
///
/// Create a string node accessor
///
///
///
public static NodeAccessor String(string value) { return new NodeAccessor(null, value, 1); }
///
/// Create a property name node accessor
///
///
public static NodeAccessor PropertyName() { return new NodeAccessor(null, null, 2); }
}
}