/// <summary> /// If there is more than one type family that the argument can be converted to, we will throw a /// AmbiguousMatchException instead of randomly picking a winner. /// </summary> private static void CheckForAmbiguousMatch(Type argumentType, List <VarEnum> compatibleComTypes) { if (compatibleComTypes.Count <= 1) { return; } String typeNames = ""; for (int i = 0; i < compatibleComTypes.Count; i++) { string typeName = _ComToManagedPrimitiveTypes[compatibleComTypes[i]].Name; if (i == (compatibleComTypes.Count - 1)) { typeNames += " and "; } else if (i != 0) { typeNames += ", "; } typeNames += typeName; } throw Error.AmbiguousConversion(argumentType.Name, typeNames); }