उदाहरण
SortedList की IsFixedSize प्रॉपर्टी बताती है कि सूची का आकार निश्चित है या नहीं। यह प्रॉपर्टी हमेशा false लौटाती है क्योंकि SortedList गतिशील रूप से आकार बदल सकती है।
using System;
using System.Collections;
public class Demo {
public static void Main() {
SortedList list = new SortedList();
list.Add("1", "One");
list.Add("2", "Two");
list.Add("3", "Three");
list.Add("4", "Four");
list.Add("5", "Five");
list.Add("6", "Six");
list.Add("7", "Seven");
list.Add("8", "Eight");
Console.WriteLine("SortedList की कुंजी और मान....");
foreach(DictionaryEntry k in list)
Console.WriteLine("Key: {0}, Value: {1}", k.Key, k.Value);
Console.WriteLine("क्या SortedList में मान है? " + list.ContainsValue("Three"));
Console.WriteLine("SortedList ऑब्जेक्ट का आकार निश्चित है? = " + list.IsFixedSize);
}
}
आउटपुट
SortedList की कुंजी और मान.... Key: 1, Value: One Key: 2, Value: Two Key: 3, Value: Three Key: 4, Value: Four Key: 5, Value: Five Key: 6, Value: Six Key: 7, Value: Seven Key: 8, Value: Eight क्या SortedList में मान है? True SortedList ऑब्जेक्ट का आकार निश्चित है? = False
एक और उदाहरण
using System;
using System.Collections;
public class Demo {
public static void Main() {
SortedList list = new SortedList();
list.Add("1", "John");
list.Add("2", "Tim");
list.Add("3", "Karl");
list.Add("4", "Gary");
list.Add("5", "Katie");
Console.WriteLine("SortedList की कुंजी और मान....");
foreach(DictionaryEntry k in list)
Console.WriteLine("Key: {0}, Value: {1}", k.Key, k.Value);
Console.WriteLine("SortedList ऑब्जेक्ट का आकार निश्चित है? = " + list.IsFixedSize);
}
}
आउटपुट
SortedList की कुंजी और मान.... Key: 1, Value: John Key: 2, Value: Tim Key: 3, Value: Karl Key: 4, Value: Gary Key: 5, Value: Katie SortedList ऑब्जेक्ट का आकार निश्चित है? = False