예제 #1
0
        /// <summary>
        /// Gets a sheet from the sheets list by name
        /// </summary>
        /// <param name="sheetsList"></param>
        /// <param name="sheetName"></param>
        /// <returns></returns>
        public static ISNSheetObj GetByName(this ISNSheetsList sheetsList, string sheetName)
        {
            sheetsList.Reset();

            while (!sheetsList.EndOfList)
            {
                var sheet = sheetsList.Current;

                if (sheet.Name.Equals(sheetName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(sheet);
                }

                sheetsList.MoveNext();
            }
            return(null);
        }
예제 #2
0
        /// <summary>
        /// Removes a sheet from the sheets list by name
        /// </summary>
        /// <param name="sheetsList"></param>
        /// <param name="sheetName"></param>
        /// <returns></returns>
        public static bool RemoveByName(this ISNSheetsList sheetsList, string sheetName)
        {
            sheetsList.Reset();

            while (!sheetsList.EndOfList)
            {
                var task = sheetsList.Current;

                if (task.Name.Equals(sheetName, StringComparison.InvariantCultureIgnoreCase))
                {
                    sheetsList.Remove();
                    return(true);
                }

                sheetsList.MoveNext();
            }
            return(false);
        }