?
Solved

Create a class that implements IOrderedQueryable

Posted on 2007-07-20
6
Medium Priority
?
526 Views
Last Modified: 2012-06-22
Hello, im currently looking for help in creating a class that implements IOrderedQueryable, in my situation the class will have a struct which contains the various fields that I would need to order by, for example:

Class: Person
Struct: Person.Data
Person.Data.Name (string
Person.Data.Age (int)

Help would be greatly appreciated, thank you
0
Comment
Question by:TheReckter
  • 3
  • 2
5 Comments
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 19537735
What interface is that?
0
 

Author Comment

by:TheReckter
ID: 19537993
the interface is IOrderedQueryable, I would like to implement it in a class called People. which is a list of the Person objects.  Within each person object is a struct called data which has the following public variables:
string Name
int Age
now I want to be able to sort the Person objects within the People class via Name and Age, im not sure whether the IOrderedQueryable interface is the best way to do it
0
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 1500 total points
ID: 19537998
I would use IComparable<> which yields the CompareTo method. Thus storing your objects in an array you can then sort them based on a property of each object of your choice.

P.S. Where abouts is that interface, i.e. namespace, as I cannot find it in the Object Browser

Andrew
0
 

Author Comment

by:TheReckter
ID: 19538086
It is found in System.Linq.  I believe the System.Linq namespace was created for 3.5 of the .NET framework, so maybe thats why you cant find it.  Ok, I will check out that interface, thank you.
0
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 19538090
and thankyou for the pointer.  I will have a peek at that cheers :)

Andrew
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question