SortedList 類在 C# 中 IsReadOnly 屬性是什麼?
使用 IsReadOnly 屬性來獲取一個值,指示 SortedList 是否為只讀。
可以嘗試執行以下程式碼來在 C# 中實現 IsReadOnly 屬性。
在此,我們首先設定 SortedList。
SortedList s = new SortedList();
新增元素。
s.Add("S001", "Jack");
s.Add("S002", "Henry");現在檢查 IsReadOnly。
Console.WriteLine("IsReadOnly = " + s.IsReadOnly);以下是完整程式碼。
示例
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
廣告
資料結構
組網
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP