Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

คุณสมบัติ IsReadOnly ของคลาส SortedList ใน C#

ใช้คุณสมบัติ IsReadOnly ตรวจสอบว่า SortedList เป็นแบบอ่านอย่างเดียวหรือไม่

ตัวอย่าง

using System; 
using System.Collections; 
namespace Demo { 
    class Program { 
        static void Main(string[] args) { 
            SortedList s = new SortedList(); 
            s.Add("S001", "Jack"); s.Add("S002", "Henry"); 
            Console.WriteLine("IsReadOnly = " + s.IsReadOnly); 
        } 
    } 
}

ผลลัพธ์

IsReadOnly = False