小编Sim*_*ght的帖子

如何使通用列表等于另一个通用列表

这是我的设置,

class CostPeriodDto : IPeriodCalculation
{
    public decimal? a { get; set; }
    public decimal? b { get; set; }
    public decimal? c { get; set; }
    public decimal? d { get; set; }
}

interface IPeriodCalculation
{
    decimal? a { get; set; }
    decimal? b { get; set; }
}

class myDto
{
    public List<CostPeriodDto> costPeriodList{ get; set; }

    public List<IPeriodCalculation> periodCalcList
    {
        get
        {
            return this.costPeriodList;  // compile error   
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这样做的最佳方式是什么?

c#

6
推荐指数
2
解决办法
818
查看次数

标签 统计

c# ×1