no arguments that correspond to the mandatory formal parameter item1 have been specified

后端 未结 2 773
眼角桃花
眼角桃花 2021-01-28 15:08

I\'ve this object:

public class RankingAll
{
   public Tuple, List> Ranking { get; set; } 
}

I\'

相关标签:
2条回答
  • 2021-01-28 15:38

    Tuples are immutable, so cannot be changed after construction. You can't set Item1 or Item2 after this point, so the only way to get values into it are at construction. This is enforced by a constructor signature that requires the values.

    You need to supply values to the constructor, or use the handy helper method:

    Tuple.Create(new List<Ranking>(), new List<RankingLegend>())
    

    Given that a Tuple is immutable, placing mutable structures within it is, IMO, somewhat questionable.

    0 讨论(0)
  • 2021-01-28 15:49

    Your tuple requires two items (A List and a List) to be passed into the constructor. You can't construct a tuple without the members of the tuple being provided.

    0 讨论(0)
提交回复
热议问题