using System; using System.Collections.Generic; using System.Text; namespace Esiur.Protocol; public interface IPropertyContext { object GetValue(EpConnection connection); } public class PropertyContext : IPropertyContext { public T Value { get; private set; } public EpConnection Connection { get; private set; } public Func Method { get; private set; } public PropertyContext(EpConnection connection, T value) { this.Value = value; this.Connection = connection; } public PropertyContext(Func method) { this.Method = method; } public static implicit operator PropertyContext(Func method) => new PropertyContext(method); public object GetValue(EpConnection connection) { return Method.Invoke(connection); } }