- 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
Arjun Thakur has Published 1109 Articles
Arjun Thakur
72 Views
Get the keys in the SortedList using the keys property of SortedList class in C#. We have first set the SortedList property with elements.SortedList sl = new SortedList(); sl.Add("ST0", "One"); sl.Add("ST1", "Two"); sl.Add("ST2", "Three"); sl.Add("ST3", "Four"); sl.Add("ST4", "Five"); sl.Add("ST5", "Six"); sl.Add("ST6", "Seven");Now use the keys property to get the keys.ICollection ... Read More
Arjun Thakur
71 Views
Use the IsReadOnly property to get a value indicating whether the SortedList is read-only or not.You can try to run the following code to implement IsReadOnly property in C#.Here, we have set the SortedList first.SortedList s = new SortedList();Added elements.s.Add("S001", "Jack"); s.Add("S002", "Henry");Now check for IsReadOnly.Console.WriteLine("IsReadOnly = " + s.IsReadOnly);The ... Read More
Arjun Thakur
2K+ Views
A nested class is a class declared in another enclosing class. It is a member of its enclosing class and the members of an enclosing class have no access to members of a nested class.Let us see an example code snippet of nested classes in C#.Exampleclass One { public ... Read More
Arjun Thakur
1K+ Views
Firstly, set a string.string str1 = "Port"; Console.WriteLine("Original String: "+str1);Now convert the string into character array.char[] ch = str1.ToCharArray();Set the character you want to replace with the index of the location. To set a character at position 3rd.ch[2] = 'F';To remove nth character from a string, try the following C# ... Read More
Arjun Thakur
1K+ Views
Get the array of the values of the constants in a specified enumeration.Here is our enum.enum Rank { Jack = 10, Tom = 19, Tim = 26 };Now, get all the values of the enum as an array and display using GetValues() method.foreach(int res in Enum.GetValues(typeof(Rank))) { Console.WriteLine(res); }Let ... Read More
Arjun Thakur
3K+ Views
CompositionUnder Composition, if the parent object is deleted, then the child object also loses its status. Composition is a special type of Aggregation and gives a part-of relationship.For example, A Car has an engine. If the car is destroyed, the engine is destroyed as well.public class Engine { . . ... Read More
Arjun Thakur
110 Views
Set an array and arrange it in descending order using OrderByDescending.int[] prod = { 290, 340, 129, 540, 456, 898, 765, 789, 345};Now, use the Take() method to return specified number of elements from the beginning.Enumerable units = prod.AsQueryable().OrderByDescending(s => s).Take(2);Let us see the complete code.Example Live Demousing System; using System.Linq; ... Read More
Arjun Thakur
851 Views
The Convert.ToByte method is used to convert a specified value to an 8-bit unsigned integer.Let’s say we have a char variable.Char charVal = ‘a’;Now, convert it to an 8-bit unsigned integer.byte byteVal = Convert.ToByte(charVal);Let us see another example now.Example Live Demousing System; public class Demo { public static void Main() ... Read More
Arjun Thakur
362 Views
The Sortable standard format specifier represents a custom date and time format string.The format string is defined by the DateTimeFormatInfo.SortableDateTimePattern property.The custom format string.yyyy'-'MM'-'dd'T'HH':'mm':'ssExample Live Demousing System; class Demo { static void Main() { DateTime date = new DateTime(2018, 9, 5, 2, 12, 40); ... Read More
Arjun Thakur
451 Views
The Count method returns the count of elements in a sequence.Let us first set an array.string[] arr = { "Java", "C++", "Python"};Now, use the Count() method to count the array elements.arr.AsQueryable().Count();The following is the complete example.Example Live Demousing System; using System.Linq; using System.Collections.Generic; class Demo { static void Main() { ... Read More