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
Tulika Kumar
1.7k
14
20.9k
Sorting of a List of Objects
Jan 11 2013 6:27 PM
I have a class named: Product
public class Product
{
string name;
public string Name { get { return name; } }
double price;
public double Price { get { return price; } }
string location;
public string Location { get { return location; } }
public Product(string name, double price, string location)
{
this.name = name;
this.price = price;
this.location = location;
}
}
Now I created a list of Product object
List<Product> lstProduct = new List<Product>{
new Product("WWW", 9.99, "ZZZZZZZZZ"),
new Product("AAA", 14.99, "RRRRRRRR"),
new Product("AAA", 12.99, "AAAAAAA"),
new Product("GGG", 13.69, "WWWWWWWWWWWWWWW"),
new Product("GGG", 13.99, "NNNNNNNN"),
new Product("KKK", 10.99, "TTTTTTTTTTTTTTTT")
};
Then, I need to sort them firstly by Name and then bind into a DataGrid.
Thanks in advance
Reply
Answers (
3
)
Change value of PropertyTagImageDescription (Bitmap/C#)
How do I make my C# Windows Forms application report stats?