- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2628 Articles for Csharp
108 Views
To check whether the specified Unicode character is a letter or a decimal digit, the code is as follows −Example Live Demousing System; public class Demo { public static void Main() { bool res; char val = '1'; Console.WriteLine("Value = "+val); res = Char.IsLetterOrDigit(val); Console.WriteLine("Is the value a letter or digit? = "+res); } }OutputThis will produce the following output −Value = 1 Is the value a letter or digit? = TrueExampleLet us see another example − Live Demousing System; public class Demo { public static void Main() { bool res; ... Read More
85 Views
To get the TypeCode for value type Char, the code is as follows −Example Live Demousing System; public class Demo { public static void Main() { char val = '5'; bool res; Console.WriteLine("Hashcode for val = "+val.GetHashCode()); res = val.Equals('m'); Console.WriteLine("Return Value = "+res); Console.WriteLine("Numeric Value = "+Char.GetNumericValue(val)); TypeCode type = val.GetTypeCode(); Console.WriteLine("Type = "+type); } }OutputThis will produce the following output −Hashcode for val = 3473461 Return Value = False Numeric Value = 5 Type = CharExampleLet us see another example − Live Demousing System; public class ... Read More
97 Views
To remove from the specified index of a SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args) { SortedList sortedList = new SortedList(); sortedList.Add("A", "1"); sortedList.Add("B", "2"); sortedList.Add("C", "3"); sortedList.Add("D", "4"); sortedList.Add("E", "5"); sortedList.Add("F", "6"); sortedList.Add("G", "7"); sortedList.Add("H", "8"); sortedList.Add("I", "9"); sortedList.Add("J", "10"); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in sortedList) ... Read More
63 Views
To remove entry with specified key from the StringDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { StringDictionary strDict1 = new StringDictionary(); strDict1.Add("A", "John"); strDict1.Add("B", "Andy"); strDict1.Add("C", "Tim"); strDict1.Add("D", "Ryan"); strDict1.Add("E", "Kevin"); strDict1.Add("F", "Katie"); strDict1.Add("G", "Brad"); Console.WriteLine("StringDictionary1 key-value pairs..."); foreach(DictionaryEntry de in strDict1) { Console.WriteLine(de.Key + " " + de.Value); ... Read More
109 Views
To remove entry with specified key from OrdererdDictionary in C#, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { OrderedDictionary dict = new OrderedDictionary(); dict.Add("A", "Books"); dict.Add("B", "Electronics"); dict.Add("C", "Smart Wearables"); dict.Add("D", "Pet Supplies"); dict.Add("E", "Clothing"); dict.Add("F", "Footwear"); Console.WriteLine("OrderedDictionary elements..."); foreach(DictionaryEntry d in dict) { Console.WriteLine(d.Key + " " + d.Value); } ... Read More
96 Views
To get the object at the beginning of the Queue, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { Queue queue = new Queue(); queue.Enqueue("A"); queue.Enqueue("B"); queue.Enqueue("C"); queue.Enqueue("D"); queue.Enqueue("E"); queue.Enqueue("F"); queue.Enqueue("G"); Console.WriteLine("Count of elements = "+queue.Count); Console.WriteLine("Element at the beginning of queue = " + queue.Peek()); } }OutputThis will produce the following output −Count of elements = 7 Element at the beginning of queue = AExampleLet us see another ... Read More
78 Views
To get or set the value associated with specified key in SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { SortedList list = new SortedList (); list.Add("A", "Books"); list.Add("B", "Electronics"); list.Add("C", "Appliances"); list.Add("D", "Pet Supplies"); list.Add("E", "Clothing"); list.Add("F", "Footwear"); Console.WriteLine("Value associated with key E = "+list["E"]); list["E"] = "HDD"; Console.WriteLine("Value associated with key E [Updated] = "+list["E"]); ... Read More
98 Views
To check if two StringDictionary objects are equal or not, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main() { StringDictionary strDict1 = new StringDictionary(); strDict1.Add("A", "John"); strDict1.Add("B", "Andy"); strDict1.Add("C", "Tim"); strDict1.Add("D", "Ryan"); strDict1.Add("E", "Kevin"); strDict1.Add("F", "Katie"); strDict1.Add("G", "Brad"); StringDictionary strDict2 = new StringDictionary(); strDict2.Add("A", "John"); strDict2.Add("B", "Andy"); strDict2.Add("C", "Tim"); strDict2.Add("D", ... Read More
77 Views
To check if two StringCollection objects are equal, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main() { StringCollection strCol1 = new StringCollection(); strCol1.Add("Accessories"); strCol1.Add("Books"); strCol1.Add("Electronics"); Console.WriteLine("StringCollection1 elements..."); foreach (string res in strCol1) { Console.WriteLine(res); } StringCollection strCol2 = new StringCollection(); strCol2.Add("Accessories"); strCol2.Add("Books"); strCol2.Add("Electronics"); Console.WriteLine("StringCollection2 elements..."); foreach ... Read More
90 Views
To get or set the value associated with specified key in ListDictionary, the code is as follows −Example Live Demousing 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"]); } }OutputThis will produce the following output −Value associated with key C = AppliancesExampleLet us see another example − Live Demousing System; using ... Read More