- 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
Karthikeya Boyini has Published 2383 Articles
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
702 Views
Implicit conversion of a 32-bit unsigned integer (UInt) to a Decimal requires you to first declare a UInt.uint val = 342741539;Now to convert it to decimal, just assign the value.decimal dec; // implicit dec = val;Example Live Demousing System; public class Demo { public static void Main() { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
139 Views
Perform Union on two sequences using the Queryable Union method.The following are our arrays.int[] arr1 = { 29, 40, 15, 55, 70, 30, 90 }; int[] arr2 = { 30, 36, 40, 18, 15, 55, 75 };Now, get the Union of the arrays using the Union method.arr1.AsQueryable().Union(arr2);Example Live Demousing System; using ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
207 Views
Let’s say our three-dimensional array is −int[, , ] arr = new int[3, 4, 5];To get the height and width i.e. the rows and columns.Array.GetLength(0) – for rows Array.GetLength(1) – for columnsExample Live Demousing System; class Program { static void Main() { int[, , ] arr = ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
8K+ Views
The TryParse() method converts the string representation of one or more enumerated constants to an equivalent enumerated object.Firstly, set an enum.enum Vehicle { Bus = 2, Truck = 4, Car = 10 };Now, let us declare a string array and set some values.string[] VehicleList = { "2", "3", "4", "bus", ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
2K+ Views
Get specified number of elements from the beginning using the Take() method.The following is our array.int[] marks = { 35, 72, 50, 90, 95, 85, 52, 67 };Now, use OrderByDescending to order the elements in Descending order. Then use the Take() method to get the elements.marks.AsQueryable().OrderByDescending(s => s).Take(5);Let us see ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
82 Views
Use ThenBy() method to order array elements. Let’s say we have the following string array.string[] str = { "Sandler", "Jack", "Tom", "Matt", "Henry", "Johnny" };Now, use Lambda Expressions and set a condition inside the ThenBy() method to sort the strings according to the number of characters they have.IEnumerable res = ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
691 Views
Use SelectMany method to collapse elements into a single collection like an error.An example would be to convert string to character array. The following is our string array.string[] str = { "Mobile", "Laptop", "Tablet" };Now, convert to character array.str.SelectMany(item => item.ToCharArray());Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
1K+ Views
Get only a single element of a sequence using the Single() method.Let’s say we have a string array with only one element.string[] str = { "one" };Now, get the element.str.AsQueryable().Single();Here is our code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
1K+ Views
Let’s say we want to remove whitespace from the following string str1.string str1 = "Brad Pitt";Now, use Regex Replace to replace whitespace with empty. Here, we have used System.Text.RegularExpressions.string str2 = System.Text.RegularExpressions.Regex.Replace(str1, @"\s+", "");Let us see the complete example.Example Live Demousing System; using System.Text.RegularExpressions; namespace Demo { class Program { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
306 Views
Use Orderby descending in C# to sort elements in descending order.The following is our list −IList emp = new List() { new Employee() { EmployeeRank = 3, EmpName = "Tom", EmpMarks = 90 } , new Employee() { EmployeeRank = 4, EmpName = "Katie", EmpMarks = 95 } };Now to ... Read More