I'm trying to convert List<ICommonKline> to List<Candle> by using user-defined conversion, which doesn't let me do it because ICommonKline is an interface.
user-defined conversions to or from an interface are not allowed
How can I do that?
This is what I'm trying to accomplish:
List<ICommonKline> smt = (await api.GetCandlesAsync("TRXUSDT", TimeSpan.FromHours(1), limit: 500)).SkipLast(1).ToList();
List<Candle> smt2 = smt.Cast<Candle>().ToList(); // System.InvalidCastException: 'Unable to cast object of type 'Binance.Net.Objects.Spot.MarketData.BinanceSpotKline' to type 'NewBot.Core.Indicators.Candle'.'
Code:
public interface ICommonKline
{
    decimal CommonHigh { get; }
    decimal CommonLow { get; }
    decimal CommonOpen { get; }
    decimal CommonClose { get; }
}
public class Candle
{
    public decimal High { get; set; }
    public decimal Low { get; set; }
    public decimal Open { get; set; }
    public decimal Close { get; set; }
    public decimal Volume { get; set; }
    public DateTime OpenTime { get; set; }
    public DateTime CloseTime { get; set; }
    public static explicit operator Candle(ICommonKline candle) // error CS0552: 'Candle.explicit operator Candle(ICommonKline)': user-defined conversions to or from an interface are not allowed
    {
        var c = new Candle();
        return c;
    }
}
 
    