ListDictionary-এ নির্দিষ্ট কী-এর সাথে যুক্ত মান পেতে বা সেট করতে, কোডটি নিম্নরূপ -
উদাহরণ
using System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { ListDictionary dict = new ListDictionary(); dict.Add("A", "Books"); dict.Add("B", "Electronics"); dict.Add("C", "Appliances"); dict.Add("D", "Pet Supplies"); dict.Add("E", "Clothing"); dict.Add("F", "Footwear"); Console.WriteLine("Value associated with key C = "+dict["C"]); } }
আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেValue associated with key C = Appliances
উদাহরণ
আসুন আরেকটি উদাহরণ দেখি -
using System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { ListDictionary dict = new ListDictionary(); dict.Add("A", "Books"); dict.Add("B", "Electronics"); dict.Add("C", "Appliances"); dict.Add("D", "Pet Supplies"); dict.Add("E", "Clothing"); dict.Add("F", "Footwear"); Console.WriteLine("Value associated with key C = "+dict["C"]); dict["C"] = "HDD"; Console.WriteLine("Value associated with key C [Updated] = "+dict["C"]); } }
আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেValue associated with key C = Appliances Value associated with key C [Updated] = HDD