find if an integer exists in a list of integers

后端 未结 8 1373
执笔经年
执笔经年 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:15

    If you just need a true/false result

    bool isInList = intList.IndexOf(intVariable) != -1;
    

    if the intVariable does not exist in the List it will return -1

提交回复
热议问题