TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aditya Varma Mudunuri
NA
58
104.6k
How to retrieve the element dynamically using List generics
Jan 8 2014 7:08 AM
Here i want to retrieve elements in array during runtime and to sort the integer array and to print the resultant array using List <int> ListInt=new List <int> ListInt{} generics. Please help me to this sample code given below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Prime2
{
class RuntimeSortOfNumbers
{
static void Main(string[] args)
{
int size;
Console.WriteLine("Enter The Size of List ");
size = int.Parse(Console.ReadLine());
Console.WriteLine("Enter The Elements in List to Sort");
List<int> IntList = new List<int> { };
for (int i = 0; i < size; i++)
{
IntList = int.Parse(Console.ReadLine());
}
IntList.Sort();
Console.WriteLine("Sorted List");
for (int i = 0; i < size; i++)
{
Console.WriteLine(IntList[i]);
}
}
}
}
Reply
Answers (
1
)
How to run Bat file cmd from website.....
Online Examination code in .net