- 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 2628 Articles for Csharp
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
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; using System.Linq; class Demo { static void Main() { string[] arr = { "Java", "HTML", "CSS", "JavaScript"}; string res = arr.AsQueryable().Aggregate("jQuery", (longest, next) => next.Length > longest.Length ? next : longest, str => str.ToLower()); Console.WriteLine("String with more ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
428 Views
Let’s say the following is our LinkedList with integer nodes.int [] num = {29, 40, 67, 89, 198, 234}; LinkedList myList = new LinkedList(num);Now, if you want to remove the first element from the list, then use the RemoveFirst() method.myList.RemoveFirst();Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { int [] num = {29, 40, 67, 89, 198, 234}; LinkedList myList = new LinkedList(num); foreach (var n in myList) { Console.WriteLine(n); } // removing first node myList.RemoveFirst(); Console.WriteLine("LinkedList after removing the first node..."); foreach (var n in myList) { Console.WriteLine(n); } } }Output29 40 67 89 198 234 LinkedList after removing the first node... 40 67 89 198 234
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
4K+ Views
To represent Int32 as a Hexadecimal string in C#, use the ToString() method and set the base as the ToString() method’s second parameter i.e. 16 for Hexadecimal.Int32 represents a 32-bit signed integer.Firstly, set an Int32 variable.int val = 9898;Now, convert it to a hexadecimal string by including 16 as the second parameter.Convert.ToString(val, 16)Example Live Demousing System; class Demo { static void Main() { int val = 9898; Console.WriteLine("Integer: "+val); Console.Write("Hex String: "+Convert.ToString(val, 16)); } }OutputInteger: 9898 Hex String: 26aa
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
95 Views
The following is our LinkedList list with nodes.string [] students = {"Katie", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students);Now let us remove a node with the string element “Vera”.For that, use Remove() method.list.Remove("Vera");Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { string [] students = {"Katie", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students); foreach (var stu in list) { Console.WriteLine(stu); } // removing a node list.Remove("Vera"); Console.WriteLine("LinkedList after removing ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
442 Views
Convert a specified value to a 64-bit signed integer using Convert.ToInt64 Method.Let us take a double value.double doubleNum = 193.834;Now, convert it to Int64 i.e. long.long res; res = Convert.ToInt32(doubleNum);Example Live Demousing System; public class Demo { public static void Main() { double doubleNum = 193.834; long res; res = Convert.ToInt32(doubleNum); Console.WriteLine("Converted {0} to {1}", doubleNum, res); } }OutputConverted 193.834 to 194
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
236 Views
Convert a specified value to an 8-bit signed integer i.e. SByte.It is a signed 8-bit integer data type which stores value between -128 to 127.Let us see an example. We have a double variable.double doubleNum = -19.9;Now, let us convert it to SByte.sbyte res; res = Convert.ToSByte(doubleNum);Example Live Demousing System; public class Demo { public static void Main() { double doubleNum = -19.9; sbyte res; res = Convert.ToSByte(doubleNum); Console.WriteLine("Converted {0} to {1}", doubleNum, res); } }OutputConverted -19.9 to -20
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
83 Views
Use the Contains() method to check whether a node is a LinkedList or not.Here is our LinkedList.string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students);Now, to check whether the node “Amy” is in the list or not, we will use the Contains() method as shown below −list.Contains("Amy")The method will return a Boolean value i.e. True in this case.Let us see the complete code.Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students); ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
Use the Remove() method to remove the first occurrence of a node in a LinkedList.Firstly, let us set a LinkedList with integer elements.int [] num = {2, 5, 7, 15}; LinkedList list = new LinkedList(num);Now, let’s say you need to remove node with element 7. For that, use the Remove() method.list.Remove(7);Let us see the complete code.Example Live Demousing System; using System.Collections.Generic; class Demo { static void Main() { int [] num = {2, 5, 7, 15}; LinkedList list = new LinkedList(num); foreach (var n in list) { ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
459 Views
The following is our array −int[] points = { 210, 250, 300, 350, 420};Use skip() method to skip elements. Add the number as an argument that displays the number of elements to be returned.IEnumerable skipEle = points.AsQueryable().OrderByDescending(s => s).Skip(3);Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] points = { 210, 250, 300, 350, 420}; Console.WriteLine("Initial array..."); foreach (int res in points) Console.WriteLine(res); IEnumerable skipEle = points.AsQueryable().OrderByDescending(s => s).Skip(3); Console.WriteLine("Skipped 3 elements..."); foreach (int res in skipEle) Console.WriteLine(res); } }OutputInitial array... 210 250 300 350 420 Skipped 3 elements... 250 210
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
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 void Main() { int [] num = {1, 2, 3, 4, 5}; LinkedList list = new LinkedList(num); foreach (var n in list) { Console.WriteLine(n); } // adding a node at the ... Read More