I have a method of type string that takes two arguments: string and double .
On output, I need to issue, as far as I understand, both arguments in string .
But an error occurs: the compiler cannot translate double to string . I tried different options: cast (string) before a double variable, double.ToString , ConvertToString , etc.
What method should I use?
The code itself:
class Program { static void Main(string[] args) { Console.WriteLine(MyMethod("Hello", 11.0)); } private static string MyMethod(string word, double num) { num = Math.Round(num); string snum = num.ToString(); return MyMethod(word, num); } }
на выходе мне нужно выдать насколько я понимаю оба аргумента в strinmeanна выходе мне нужно выдать насколько я понимаю оба аргумента в strin? Show your code. - sp7MyMethodmethod looks like endless recursion. What is the meaning of this method? - Regent$"{word} {Math.Round(num)}"- Grundy