コード例 #1
0
        /// <summary>
        /// Gets the global list values.
        /// </summary>
        /// <param name="workItemStore">The WorkItemStore to query.</param>
        /// <param name="globalListName">Name of the global list.</param>
        /// <returns></returns>
        public static IEnumerable <string> GetGlobalListValues(this WorkItemStore workItemStore, string globalListName)
        {
            if (workItemStore == null)
            {
                throw new ArgumentNullException("workItemStore");
            }
            if (globalListName == null)
            {
                throw new ArgumentNullException("globalListName");
            }
            if (string.IsNullOrWhiteSpace(globalListName))
            {
                throw new ArgumentOutOfRangeException("globalListName");
            }

            var globalList =
                workItemStore.GetGlobalLists().FirstOrDefault(
                    list => list.Name.Equals(globalListName, StringComparison.InvariantCultureIgnoreCase));

            if (globalList == null)
            {
                throw new ArgumentOutOfRangeException("globalListName", "A global list with this name does not exist in WorkItemStore");
            }

            return(globalList.Values ?? Enumerable.Empty <string>());
        }