Generic version for ObjectContainer.NamedList(String listName)

Thread is closed for posting
1 posts, 0 answers
  1. B80BAA9E-6FB0-469A-AE13-50D9F636C53B
    B80BAA9E-6FB0-469A-AE13-50D9F636C53B avatar
    82 posts
    Member since:
    Jun 2012

    Posted 08 Aug 2009 Link to this post


    .NET version


    programming language



    This is a very simple alternative implemented as a c# extension method.
    Note that the namespace is Telerik.OpenAccess so every place you use this namespace you'll see the extension method.
    Really simple. You just need to reference this class. Enjoy!

    using System;
    using System.Collections.Generic;
    using System.Collections;

    namespace Telerik.OpenAccess
        public static class OpenAccessExtensions

            #region ObjectContainer

            /// <summary>
            /// Generic version for ObjectContainer.NamedList(String listName)
            /// </summary>
            public static IList<T> NamedList<T>(this ObjectContainer container, String listName)
                IList<T> result = null;

                IList originalList = container.NamedList(listName);
                if (originalList != null)
                    result = new List<T>();
                    foreach (T value in originalList)
                return result;


Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.