find if an integer exists in a list of integers

后端 未结 8 1374
执笔经年
执笔经年 2020-12-14 05:40

i have this code:

  List apps = getApps();

        List ids;

        List dropdown = apps.ConvertAll(c => new          


        
8条回答
  •  执念已碎
    2020-12-14 06:03

    You should be referencing Selected not ids.Contains as the last line.

    I just realized this is a formatting issue, from the OP. Regardless you should be referencing the value in Selected. I recommend adding some Console.WriteLine calls to see exactly what is being printed out on each line and also what each value is.

    After your update: ids is an empty list, how is this not throwing a NullReferenceException? As it was never initialized in that code block

提交回复
热议问题