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
In 1 line, not very efficient but works:
public string RomanNumeralFrom(int number)
{
return
new string('I', number)
.Replace(new string('I', 1000), "M")
.Replace(new string('I', 900), "CM")
.Replace(new string('I', 500), "D")
.Replace(new string('I', 400), "CD")
.Replace(new string('I', 100), "C")
.Replace(new string('I', 90), "XC")
.Replace(new string('I', 50), "L")
.Replace(new string('I', 40), "XL")
.Replace(new string('I', 10), "X")
.Replace(new string('I', 9), "IX")
.Replace(new string('I', 5), "V")
.Replace(new string('I', 4), "IV");
}