- 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
Found 34489 Articles for Programming
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
218 Views
Firstly, set a string array.string [] students = {"Tim","Jack","Henry","David","Tom"};Now, add it to the LinkedList.LinkedList list = new LinkedList(students);The above creates a LinkedList and adds node to it.Let us see the complete example.Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { string [] students = {"Tim","Jack","Henry","David","Tom"}; LinkedList list = new LinkedList(students); foreach (var stu in list) { Console.WriteLine(stu); } } }OutputTim Jack Henry David Tom
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
156 Views
Let’s add two sequences.Integer Array.int[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8 };String Array.string[] stringArray = { "Depp", "Cruise", "Pitt", "Clooney", "Sandler", "Affleck", "Tarantino" };Now to merge both the above sequences, use the Zip method.ntArray.AsQueryable().Zip(stringArray, (one, two) => one + " " + two);Let us see the complete code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8 }; string[] stringArray = { "Depp", "Cruise", "Pitt", "Clooney", "Sandler", "Affleck", "Tarantino" ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
729 Views
The Convert.ToDateTime method converts a given value to a DateTime value.The following is my string.string myDateString; myDateString = "09/09/2018";Now, let us convert it using the Convert.ToDateTime() method.DateTime result; result = Convert.ToDateTime(myDateString);Here is the complete example.Example Live Demousing System; public class Demo { public static void Main() { string myDateString; DateTime result; myDateString = "09/09/2018"; result = Convert.ToDateTime(myDateString); Console.WriteLine("'{0}' converted to {1}", myDateString, result); } }Output'09/09/2018' converted to 9/9/2018 12:00:00 AM
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
930 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 void Main() { sbyte[] byteVal = { 92, 111, 115 }; char charVal; foreach (sbyte b in byteVal) { charVal = Convert.ToChar(b); Console.WriteLine("{0} converted to '{1}'", b, charVal); } } }Output92 converted to '\' 111 converted to 'o' 115 converted to 's'
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
3K+ Views
TimeSpan Seconds() is part of time, whereas TimeSpan TotalSeconds() converts entire time to seconds.Let us first see the TimeSpan Seconds() method.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0); // seconds Console.WriteLine(ts.Seconds); } }Output20Now, let us see how TotalSeconds works for the same TimeSpan value.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0); // ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
62 Views
We have a list without any element.List val = new List { };To display the default and avoid any error, use the FirstorDefault() method.val.AsQueryable().FirstOrDefault();You can also change the value to be displayed as default.Let us see the code.Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo { static void Main() { List val = new List{ }; float a = val.AsQueryable().FirstOrDefault(); Console.WriteLine("Default Value = "+a); if (a == 0.0f) { a = 0.1f; } Console.WriteLine("Default Float value updated = "+a); } }OutputDefault Value = 0 Default Float value updated = 0.1
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
307 Views
Pad the beginning of the string with spaces using the PadLeft() method. You can also pad it with a Unicode character.Let’s say the following is our string.string myStr = "DemoOne";To set a padding at the beginning of the above string, use the PadLeft method.myStr.PadLeft(10);Here is the complete example.Example Live Demousing System; class Demo { static void Main() { string myStr = "DemoOne"; // set padding at the beginning Console.WriteLine(myStr.PadLeft(10)); myStr = "DemoTWO"; // set padding at the beginning Console.Write(myStr.PadLeft(15)); } }OutputDemoOne DemoTWO
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
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
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
785 Views
To get the absolute value of time, use the TimesSpan Duration() method.Let’s say the following is our TimeSpan.TimeSpan ts = new TimeSpan(-7, -50, -25);Now to get the absolute value.TimeSpan duration = ts.Duration();Let us see the complete code.Example Live Demousing System; using System.Linq; public class Demo { public static void Main() { TimeSpan ts = new TimeSpan(-7, -50, -25); TimeSpan duration = ts.Duration(); Console.WriteLine(duration); } }Output07:50:25