Tutorialspoint

1 Answer
Samual Sam
, 12 Views

To convert a specified value to a double-precision floating-point number, use Convert.ToDouble() method.

The following is our long value −

long[] val = { 340, -200};

Now convert it to Double.

double result;
result = Convert.ToDouble(val);

Example

Live Demo

using System;
public class Demo {
   public static void Main() {
      long[] val = { 340, -200};
      double result;
      // long to double
      foreach (long number in val) {
         result = Convert.ToDouble(number);
         Console.WriteLine("Converted {0} value to {1}",number, result);
      }
   }
}

Output

Converted 340 value to 340
Converted -200 value to -200

Advertisements