কম্পিউটার

C# এ ArrayList-এর জন্য একটি পঠনযোগ্য মোড়ক তৈরি করা হচ্ছে


অ্যারেলিস্টের জন্য একটি পঠনযোগ্য মোড়ক তৈরি করতে, কোডটি নিম্নরূপ -

উদাহরণ

using System;
using System.Collections;
public class Demo {
   public static void Main(){
      ArrayList list = new ArrayList();
      list.Add("One");
      list.Add("Two");
      list.Add("Three");
      list.Add("Four");
      list.Add("Five");
      list.Add("Six");
      list.Add("Seven");
      list.Add("Eight");
      Console.WriteLine("ArrayList elements...");
      foreach(string str in list){
         Console.WriteLine(str);
      }
      Console.WriteLine("ArrayList is read-only? = "+list.IsReadOnly);
   }
}

আউটপুট

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে
ArrayList elements...
One
Two
Three
Four
Five
Six
Seven
Eight
ArrayList is read-only? = False

উদাহরণ

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

using System;
using System.Collections;
public class Demo {
   public static void Main(){
      ArrayList list = new ArrayList();
      list.Add("One");
      list.Add("Two");
      list.Add("Three");
      list.Add("Four");
      list.Add("Five");
      list.Add("Six");
      list.Add("Seven");
      list.Add("Eight");
      Console.WriteLine("ArrayList elements...");
      foreach(string str in list){
         Console.WriteLine(str);
      }
      Console.WriteLine("ArrayList is read-only? = "+list.IsReadOnly);
      ArrayList list2 = ArrayList.ReadOnly(list);
      Console.WriteLine("ArrayList is read-only now? = "+list2.IsReadOnly);
   }
}

আউটপুট

এটি নিম্নলিখিত আউটপুট −

তৈরি করবে
ArrayList elements...
One
Two
Three
Four
Five
Six
Seven
Eight
ArrayList is read-only? = False ArrayList is read-only now? = True

  1. একটি কুইজ তৈরির জন্য 5টি সেরা অ্যান্ড্রয়েড অ্যাপ৷

  2. নিখুঁত পেশাদার ইমেল স্বাক্ষর তৈরি করার জন্য 7 টিপস

  3. কিভাবে Pyplot একটি চিত্র জন্য অক্ষ তালিকা পেতে?

  4. অ্যান্ড্রয়েডের জন্য সেরা মুদি কেনাকাটার তালিকার 4টি অ্যাপ