
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 2587 Articles for Csharp

360 Views
To check if Caps Lock is on or off through Console, the code is as follows −Example Live Demousing System; public class Demo{ public static void Main(string[] args){ Console.WriteLine("The CAPS LOCK is on or not? "+ Console.CapsLock); } }OutputThis will produce the following output −The CAPS LOCK is on or not? FalseExampleTo check if Num Lock is on or off through Console, the code is as follows − Live Demousing System; public class Demo{ public static void Main(string[] args){ Console.WriteLine("The Num LOCK is on or not? "+ Console.NumberLock); } }OutputThis will produce ... Read More

84 Views
To retrieve the system’s reference to the specified String, the code is as follows −Example Live Demousing System; public class Demo{ public static void Main(string[] args){ string str1 = "David"; string str2 = string.Intern(str1); Console.WriteLine("String1 = "+str1); Console.WriteLine("System reference of String1 = "+str2); } }OutputThis will produce the following output −String1 = David System reference of String1 = DavidExampleLet us now see another example − Live Demousing System; public class Demo{ public static void Main(string[] args){ string str1 = "50"; ... Read More

248 Views
To remove the element from the specified index of the List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args){ List list = new List(); list.Add("Ryan"); list.Add("Kevin"); list.Add("Andre"); list.Add("Tom"); list.Add("Fred"); list.Add("Jason"); list.Add("Jacob"); list.Add("David"); Console.WriteLine("Count of elements in the List = "+list.Count); Console.WriteLine("Enumerator iterates through the list elements..."); List.Enumerator demoEnum = list.GetEnumerator(); ... Read More

327 Views
To play user modified beep sound through Console, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); Console.WriteLine("Beep sound through Console with frequence 1000 hertz and duration 500 milliseconds"); Console.Beep(1000, 500); } }OutputThis will produce the following output −Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through Console Beep sound through Console with frequence 1000 ... Read More

167 Views
To get the HashCode of the tuple, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args){ var tuple1 = Tuple.Create(150, 400, 500, 700, 100, 1200, 1500, Tuple.Create(50, 100)); var tuple2 = Tuple.Create(150, 400, 500, 700, 100, 1200, 1500, Tuple.Create(100, 200)); Console.WriteLine("Is Tuple1 equal to Tuple2? = "+tuple1.Equals(tuple2)); Console.WriteLine("HashCode of Tuple1 = "+tuple1.GetHashCode()); Console.WriteLine("HashCode of Tuple2 = "+tuple2.GetHashCode()); } }OutputThis will produce the following output −Is Tuple1 equal to Tuple2? = False HashCode of Tuple1 = ... Read More

119 Views
To create a StringCollection in C#, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main(){ StringCollection strCol = new StringCollection(); String[] strArr = new String[] { "A", "B", "C", "D", "E", "F", "G", "H" }; Console.WriteLine("StringCollection elements..."); foreach (string str in strArr){ Console.WriteLine(str); } strCol.AddRange(strArr); Console.WriteLine("Element at 5th index = "+strCol[5]); Console.WriteLine("Count of strings in StringCollection = " + strCol.Count); } ... Read More

216 Views
To create a shallow copy of SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args){ SortedList list = new SortedList(); list.Add("A", "Jacob"); list.Add("B", "Sam"); list.Add("C", "Tom"); list.Add("D", "John"); list.Add("E", "Tim"); list.Add("F", "Mark"); list.Add("G", "Gary"); list.Add("H", "Nathan"); list.Add("I", "Shaun"); list.Add("J", "David"); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in list){ ... Read More

257 Views
To play beep sound through Console, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); } }OutputThis will produce the following output −Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through ConsoleExampleLet us now see another example − Live Demousing System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard ... Read More

233 Views
To perform a specified action on each element of the List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void demo(int s){ s = s * 10; Console.WriteLine(s); } public static void Main(String[] args){ List list = new List(); list.Add(25); list.Add(50); list.Add(75); list.Add(100); list.Add(200); list.Add(250); list.Add(275); list.Add(300); Console.WriteLine("List..."); foreach (int ... Read More

283 Views
To insert the elements of a collection into the List at the specified index, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args){ string[] strArr = { "John", "Tom", "Kevin", "Mark", "Gary" }; List list = new List(strArr); Console.WriteLine("Elements in a List..."); foreach(string str in list){ Console.WriteLine(str); } strArr = new string[] { "Demo", "Text" }; Console.WriteLine("Inserted new elements in a range..."); ... Read More