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; } }
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; } }