🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Burak Kemal KOYUNCU / C# / Contains Kullanımı

1-) C# - Contains Kullanımı

C# Linq Contains Metodu

    Tanımlanan int türündeki List'te değerin olup olmadığı kontrol edilir. Koşula uygun değer var ise True, yok ise False sonucu döner.

1

using System;

2

using System.Collections.Generic;

3

4

namespace Contains

5

{

6

    public class Program

7

    {

8

        public static void Main(string[] args)

9

        {

10

            var numbers = new List<int> {5, 10, 15, 20, 25, 30};

11

            bool result = numbers.Contains(25);

12

13

            Console.WriteLine(result);

14

            Console.ReadLine();

15

        }

16

    }

17

}

 

 2021 Ocak 21 Perşembe
 572