public static string ConvertToReturnCode(this object returnCode)
{
var statusType = returnCode.GetType();
if (!statusType.IsIntOrEnum())
{
throw new ArgumentException("The status can only be an enum or an integer.", nameof(returnCode));
}
var result = returnCode.ToString();
if (statusType.IsEnum())
{
result = Enum.Format(statusType, returnCode, "D");
}
return result;
}