[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’ to ‘double’