কম্পিউটার

C# অ্যারেতে TrueForAll() পদ্ধতি


অ্যারেতে TrueForAll() পদ্ধতির সাথে, আপনি একটি শর্তের জন্য প্রতিটি উপাদান পরীক্ষা করতে পারেন।

আসুন একটি উদাহরণ দেখি -

উদাহরণ

using System;
using System.Text;
public class Demo {
   public static void Main() {
      int[] val = { 97, 45, 76, 21, 89, 45 };
      // checking whether all the array element are more than one or not
      bool result = Array.TrueForAll(val, res => res > 1);
      Console.WriteLine(result);
   }
}

আউটপুট

True

অ্যারেতে TrueForAll() পদ্ধতির সাথে, আপনি একটি শর্তের জন্য প্রতিটি উপাদান পরীক্ষা করতে পারেন।

আসুন একটি উদাহরণ দেখি -

উদাহরণ

using System;
using System.Text;
public class Demo {
   public static void Main() {
      int[] val = { 97, 45, 76, 21, 89, 45 };
      // checking whether all the array element are more than one or not
      bool result = Array.TrueForAll(val, res => res > 1);
      Console.WriteLine(result);
   }
}

আউটপুট

True

  1. C# AddRange() পদ্ধতি ব্যবহার করে দুটি অ্যারে মার্জ করুন

  2. C# এ GroupBy() পদ্ধতি

  3. C# এ CompareTo() পদ্ধতি

  4. অ্যারে#জিপ পদ্ধতি