troubleshooting Question

How do I order items within a C# List?

Avatar of aspnet-scotland
aspnet-scotlandFlag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingC#ASP.NET
6 Comments2 Solutions549 ViewsLast Modified:

I have the below code. I am filling a list with data objects. I have an "Order" property but I'm not too sure how I can alter my code to sort the data objects on this order property?

public List<PhoenixWCF.Brand> BrandsByCategoryId(int intBrandCategoryId)
            List<PhoenixWCF.Brand> brands = new List<PhoenixWCF.Brand>();

            foreach (var brand in Brands)
                if(brand.BrandCategoryId == intBrandCategoryId)

            return brands;

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros