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
Maha
NA
0
329.5k
Orderby clause
Sep 30 2013 9:32 AM
This program is given in the following website. Even though the word "ascending" is not in result0 assignment, o/p is in the ascending order. Please explain the reason. Problem is highlighted.
http://www.dotnetperls.com/orderby
using System;
using System.Linq;
class Program
{
static void Main()
{
// Input array.
int[] array = { 2, 5, 3 };
// Use orderby, orderby ascending, and orderby descending.
var result0 = from element in array
orderby element
select element;
var result1 = from element in array
orderby element ascending
select element;
var result2 = from element in array
orderby element descending
select element;
// Print results.
Console.WriteLine("result0");
foreach (var element in result0)
Console.WriteLine(element);
Console.WriteLine("result1");
foreach (var element in result1)
Console.WriteLine(element);
Console.WriteLine("result2");
foreach (var element in result2)
Console.WriteLine(element);
Console.ReadKey();
}
}
/*
result0
2
3
5
result1
2
3
5
result2
5
3
2
*/
Reply
Answers (
4
)
Read content of another application (chat application) in c#
Passing the parameter...