- 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
Chandu yadav has Published 1163 Articles
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
334 Views
To handle empty collections, use the DefaultIfEmpty() method in C#.If an array is empty, then using this method will show the default method instead of displaying an error.Let’s say we have an empty list.List myList = new List();Now, use DefaultIfEmpty() method to display the default value.myList.DefaultIfEmpty();Example Live Demousing System; using System.Linq; ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
293 Views
The following is the array and its elements −int[] arr = { 10, 20, 15 };Set negative value to positive elements.if (arr[i] > 0) arr[i] = -arr[i];Loop the above until the length of the array.for (int i = 0; i < arr.Length; i++) { Console.WriteLine(arr[i]); if (arr[i] > ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
729 Views
The following is our string array −string[] arr = { "Java", "HTML", "CSS", "JavaScript"};Use the Aggregate method and set a Lambda Expression to find the string with more number of characters.Here, the resultant string should have more number of characters than the initial seed value i.e. “jQuery” here.Example Live Demousing System; ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
167 Views
SByte represents an 8-bit signed integer.To implicitly convert an 8-bit signed integer to a Decimal, firstly set an sbyte value.sbyte val = 51;To convert sbyte to decimal, assign the value.decimal d; d = val;Let us see another example.Exampleusing System; public class Demo { public static void Main() { ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
1K+ Views
Set a LinkedList.int [] num = {1, 2, 3, 4, 5}; LinkedList list = new LinkedList(num);Now add a node at the end using AddLast() method.var newNode = list.AddLast(20);To add a node after the above added node, use the AddAfter() method.list.AddAfter(newNode, 30);Example Live Demousing System; using System.Collections.Generic; class Demo { static ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
234 Views
To return a collection with repeated elements in C#, use Enumerable.Repeat method.It is part of System.Linq namespace.Let’s say you need to repeat a number twice, for that set the number and the frequency of repetition.Enumerable.Repeat(50, 2);Now assign it to a variable and display it.Example Live Demousing System; using System.Linq; class Demo ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
91 Views
Use the BufferHeight gets or sets the height of the buffer area.Use the property like this −Console.BufferHeightLet us see the complete example.Example Live Demousing System; class Demo { static void Main() { Console.WriteLine("Buffer height (rows) = "+Console.BufferHeight); } }OutputBuffer height (rows) = 0
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
926 Views
The Convert.ToChar method is used to convert a specified value to a Unicode integer.We have declared an sbyte variable.sbyte byteVal = 200;Now, use the Convert.ToChar() method to convert the sbyte value to a Unicode integer.charVal = Convert.ToChar(b);Let us see another example.Example Live Demousing System; public class Demo { public static ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
4K+ Views
To set the max value for a Date, use the DateTime property MaxValue.DateTime max = DateTime.MaxValue;Now, display the value of max to get the maximum value of a date as shown below.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { DateTime ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
Chandu yadav
210 Views
Set a LinkedList and add elements.string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students);Firstly, add a new node at the end.var newNode = list.AddLast("Emma");Now, use the AddAfter() method to add a node after the given node.list.AddAfter(newNode, "Matt");The following is the complete code.Example Live Demousing System; using System.Collections.Generic; ... Read More