I\'m trying to write a function that converts numbers to roman numerals. This is my code so far; however, it only works with numbers that are less than 400. Is there a quick
I find BrunoLM's code very simple and elegant but the From(...) function
really needs to check if the source is a valid roman numeral.
Something like this
public static bool IsValidRomanNumber(string source) {
bool result = true;
string[] invalidCouples = { "VV", "LL", "DD", "VX", "VC", "VM", "LC", "LM", "DM", "IC", "IM", "XM" };
foreach (string s in invalidCouples) {
if (source.Contains(s)) {
result = false;
break;
}
}
return result;
}