Generic version for ObjectContainer.NamedList(String listName)

1 posts, 0 answers
  1. gmendez
    gmendez 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