- 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
Samual Sam has Published 2492 Articles
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
2K+ Views
To convert an Int32 value to a decimal, use the Convert.ToDecimal() method.Int32 represents a 32-bit signed integer.Let’s say the following is our Int32 value.int val = 2923;Now to convert it to decimal.decimal decVal = Convert.ToDecimal(val);Let us see the complete example.Example Live Demousing System; public class Demo { public static void ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
15K+ Views
To convert a Double value to an integer value, use the Convert.ToInt32() method.Int32 represents a 32-bit signed integer.Let’s say the following is our double value.double val = 21.34;Now to convert it to Int32.int res = Convert.ToInt32(val);Let us see the complete example.Example Live Demousing System; public class Demo { public static ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
1K+ Views
To cast elements, use the Cast() method.The following is our list.List myList = new List { "Mac", "Windows", "Linux", "Solaris" };Now, cast and use the Cast() method with substring() method to display the first two letters of every string in the list.IEnumerable res = myList.AsQueryable().Cast().Select(str => str.Substring(0, 2));Let us see ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
156 Views
To orders elements in a sequence in descending order, use ThenBy() and OrderByDescending.This is our string array.string[] myStr = { "Keyboard", "Laptop", "Mouse", "Monitor" };Now, use OrderByDescending to order element in Descending order. Inside that calculate the length of each string and use Lambda Expressions as well.IEnumerable res = myStr.AsQueryable().OrderByDescending(ch ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
1K+ Views
Merge sequences using predicate with Zip method.Here are our arrays to be merged.int[] intArray = { 10, 20, 30, 40 }; string[] stringArray = { "Jack", "Tim", "Henry", "Tom" };Now let’s use the Zip method to merge both the arrays.intArray.AsQueryable().Zip(stringArray, (one, two) => one + " " + two)The following ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
2K+ Views
Skip elements from the end and return the remaining elements using the SkipLast() method.The following is an array.int[] marks = { 45, 88, 50, 90, 95, 85 };Now, let us skip two elements from the end using SkipLast() and Lambda Expressions, but this is done after arranging the elements in ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
9K+ Views
Find the sum of elements using the Linq Sum() method.Here’s our list with integer elements.List list = new List { 99, 34, 77, 75, 87, 35, 88};Now find the sum using the Sum() method.list.AsQueryable().Sum();The following is an example to find the sum of elements of a list with integer elements.Example Live ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
498 Views
Get elements as long as the condition is true in a sequence using the TakeWhile() method.The following is our list with strings.IList str = new List(){ "Car", "Bus", "Truck", "Airplane"};Now, let’s say we need the strings whose length is less than 4. For that, use Lambda Expressions and add it ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
301 Views
Declare a string array.string [] students = {"Jenifer", "Angelina", "Vera"};Add it to a LinkedList.string [] students = {"Jenifer", "Angelina", "Vera"};Now, use AddLast() method to add a node at the end.list.AddLast("Anne");Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { string [] students = {"Jenifer", ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
3K+ Views
The method returns a single specific element of a sequence. If the element is not present in the sequence, then the default value is returned.We have two string arrays here.string[] str1 = { "one" }; string[] str2 = { };First array is checked for a single element, whereas the second ... Read More