[Solved] Error CS0030: Cannot convert type ‘void’ to ‘double’

Modify your function and use it like in example below. using System; public class Program { public static double Decode(string a) { return double.Parse(a); } public static void Main() { var decoded = Decode(“2.1”); Console.WriteLine(decoded); } } OUTPUT: 2.1 If you want improve this function read about Double.TryParse. solved Error CS0030: Cannot convert type ‘void’ … Read more

[Solved] When should I return pointer to object (not an object) from the operator function?

You got a bad example. Short answer: never(!) return a pointer from a binary function (operator). Return by value or a std::unique_ptr or std::shared_ptr. Note: The accepted answer in the link of the question changed afterward. 2 solved When should I return pointer to object (not an object) from the operator function?

[Solved] How to return an array in C# without creating array inside the method? [closed]

static IEnumerable<int> Number(int number1, int number2){ for(int i=number1; i<=number2; i++) { if(i%2==1) { yield return i; } } } or static int[] Number(int number1, int number2){ var x = new int[number2]; int y = 0; for(int i=number1; i<=number2; i++) { if(i%2==1) { x[y] = i; y++; } } return x; } This is what you … Read more