Check if List values are consecutive

前端 未结 12 1817
悲&欢浪女
悲&欢浪女 2021-02-01 05:46
List dansConList = new List();
dansConList[0] = 1;
dansConList[1] = 2;
dansConList[2] = 3;

List dansRandomList = new List

        
12条回答
  •  孤城傲影
    2021-02-01 06:16

    It is works for unique list only.

    List dansConList = new List();
    dansConList.Add(7);
    dansConList.Add(8);
    dansConList.Add(9);
    
    bool b = (dansConList.Min() + dansConList.Max())*((decimal)dansConList.Count())/2.0m == dansConList.Sum();
    

提交回复
热议问题