I have a function that converts an integer to its binary representation. I am wondering if there is any way I can improve the function.
public List<string> Conversion(int x)
{
var bitConversion = new List<string>();
var result = x;
while (result >= 0)
{
if (result == 0)
{
bitConversion.Add("0");
break;
}
bitConversion.Add((result % 2).ToString(CultureInfo.InvariantCulture));
result = result / 2;
}
bitConversion.Reverse();
return bitConversion;
}