find if an integer exists in a list of integers

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

    As long as your list is initialized with values and that value actually exists in the list, then Contains should return true.

    I tried the following:

    var list = new List {1,2,3,4,5};
    var intVar = 4;
    var exists = list.Contains(intVar);
    

    And exists is indeed set to true.

提交回复
热议问题