কম্পিউটার

SortedDictionary. C# এ সরান() পদ্ধতি


C#-এ SortedDictionary.Remove() পদ্ধতিটি SortedDictionary থেকে নির্দিষ্ট কী দিয়ে উপাদানটি সরাতে ব্যবহৃত হয়।

আউটপুট

সিনট্যাক্স নিম্নরূপ -

public bool Remove (TKey কী);

উপরে, প্যারামিটার কীটি সরানোর উপাদানটির কী।

উদাহরণ

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

ব্যবহার করে System;using System.Collections;using System.Collections.Generic;public class Demo { public static void Main(){ SortedDictionary sortedDict =new SortedDictionary(); sortedDict.Add(100, "মোবাইল"); sortedDict.Add(200, "ল্যাপটপ"); sortedDict.Add(300, "ডেস্কটপ"); sortedDict.Add(400, "স্পীকার"); sortedDict.Add(500, "হেডফোন"); sortedDict.Add(600, "Earphone"); Console.WriteLine("SortedDictionary key-value জোড়া..."); IDictionaryEnumerator demoEnum =sortedDict.GetEnumerator(); যখন (demoEnum.MoveNext()) Console.WriteLine("Key =" + demoEnum.Key + ", Value =" + demoEnum.Value); Console.WriteLine("\nSortedDictionary থেকে কী 400 সরানো হয়েছে? ="+sortedDict.Remove(400)); Console.WriteLine("\nSortedDictionary key-value জোড়া...UPDATED"); demoEnum =sortedDict.GetEnumerator(); যখন (demoEnum.MoveNext()) Console.WriteLine("Key =" + demoEnum.Key + ", Value =" + demoEnum.Value); SortedDictionary.KeyCollection keyColl =sortedDict.Keys; Console.WriteLine("\nকী...তালিকা"); foreach( int i in keyColl ){ Console.WriteLine(i); } } }

আউটপুট

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

তৈরি করবে
বাছাই করা অভিধান কী-মান জোড়া...কী =100, মান =মোবাইলকি =200, মান =ল্যাপটপকি =300, মান =ডেস্কটপকি =400, মান =স্পিকারকি =500, মান =হেডফোনকি =600, মান =Ear0 0 বাছাই করা অভিধান থেকে? =TrueSortedDictionary key-value পেয়ার...UPDATEDKey =100, মান =MobileKey =200, মান =LaptopKey =300, মান =DesktopKey =500, মান =HeadphoneKey =600, মান =EarphoneKeys...list10060 

উদাহরণ

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

ব্যবহার করে System;using System.Collections;using System.Collections.Generic;public class Demo { public static void Main(){ SortedDictionary sortedDict =new SortedDictionary(); sortedDict.Add(1, "আলট্রাবুক"); sortedDict.Add(2, "Alienware"); sortedDict.Add(3, "নোটবুক"); sortedDict.Add(4, "সংযোগকারী"); sortedDict.Add(5, "ফ্ল্যাশ ড্রাইভ"); sortedDict.Add(6, "SSD"); sortedDict.Add(7, "HDD"); sortedDict.Add(8, "Earphone"); Console.WriteLine("SortedDictionary key-value জোড়া..."); IDictionaryEnumerator demoEnum =sortedDict.GetEnumerator(); যখন (demoEnum.MoveNext()) Console.WriteLine("Key =" + demoEnum.Key + ", Value =" + demoEnum.Value); Console.WriteLine("\nSortedDictionary থেকে কী 7 সরানো হয়েছে? ="+sortedDict.Remove(7)); Console.WriteLine("\nSortedDictionary key-value জোড়া...UPDATED"); demoEnum =sortedDict.GetEnumerator(); যখন (demoEnum.MoveNext()) Console.WriteLine("Key =" + demoEnum.Key + ", Value =" + demoEnum.Value); SortedDictionary.KeyCollection keyColl =sortedDict.Keys; Console.WriteLine("\nকী...তালিকা"); foreach( int i in keyColl ){ Console.WriteLine(i); } } }

আউটপুট

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

তৈরি করবে
SortedDictionary key-value জোড়া...কী =1, মান =UltrabookKey =2, মান =AlienwareKey =3, মান =NotebookKey =4, মান =ConnectorKey =5, মান =Flash DriveKey =6, মান =SSDKey =7, মান =HDDKey =8, মান =EarphoneKey 7 SortedDictionary থেকে সরানো হয়েছে? =TrueSortedDictionary কী-মান জোড়া...UPDATEDKey =1, মান =UltrabookKey =2, মান =AlienwareKey =3, মান =NotebookKey =4, মান =ConnectorKey =5, মান =Flash DriveKey =6, মান =SSDKey =8, মান =ইয়ারফোন কী...লিস্ট1234568

  1. HTML DOM অপসারণ() পদ্ধতি নির্বাচন করুন

  2. HTML DOM স্টোরেজ কী() পদ্ধতি

  3. C# এ লিঙ্কডলিস্ট অপসারণের পদ্ধতি

  4. কিভাবে কঙ্কাল কী সরাতে হয়