troubleshooting Question

Sorting items in list

Avatar of websss
websssFlag for Kenya asked on
4 Comments1 Solution295 ViewsLast Modified:

I have inherited a piece of code which outputs images from a CMS
The images are in a slideshow, and i would like to sort the items but Name, however, i'm not sure how to do this
below is the code

And I would like to sort the all the images by NAME:
(Name = item.GetMetaData("Name") as string)

How would i do this?
private List<ImageGalleryItem> GetSlides(string imageGalleryName)
        List<ImageGalleryItem> slides = new List<ImageGalleryItem>();

        LibraryManager mgr = new LibraryManager();
        ILibrary lib = mgr.GetLibrary(imageGalleryName);
        if (lib != null)
            IList items = lib.GetItems();

            foreach (IContent item in items)
                slides.Add(new ImageGalleryItem()
                    Url = item.UrlWithExtension,
                    Name = item.GetMetaData("Name") as string,
                    Caption = item.GetMetaData("AlternateText") as string

        return slides;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
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 1 Answer and 4 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