예제 #1
0
        public static string PostfixDuplicate(string prefix, PostfixDuplicateIncrementHandler duplicateHandler)
        {
            if (duplicateHandler == null)
            {
                throw new ArgumentNullException("A PostfixDuplicateIncrementHandler delegate must be given");
            }

            string name = prefix;

            for (int i = 1; true; i++)
            {
                if (!duplicateHandler(name))
                {
                    return(name);
                }

                name = prefix + " " + i;
            }
        }
예제 #2
0
        public static string PostfixDuplicate(string prefix, PostfixDuplicateIncrementHandler duplicateHandler)
        {
            if (duplicateHandler == null) {
                throw new ArgumentNullException ("A PostfixDuplicateIncrementHandler delegate must be given");
            }

            string name = prefix;
            for (int i = 1; true; i++) {
                if (!duplicateHandler (name)) {
                    return name;
                }

                name = prefix + " " + i;
            }
        }