![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
How to sort an array in C#?
The following is the integer array.
int[] arr = { 99, 43, 86 };
To sort, use the Sort() method.
Array.Sort(arr);
The following is the complete code displaying how to sort an array in C# using the Sort() method.
Example
using System; class Demo { static void Main() { int[] arr = { 99, 43, 86 }; // sort Array.Sort(arr); Console.WriteLine("Sorted List"); foreach (int res in arr) { Console.Write("
"+res); } Console.WriteLine(); } }
Output
Sorted List 43 86 99
Advertisements