How to convert double to decimal in C#

1 Answer

0 votes
using System;

public static class Program
{
    public static void Main()
    {
        double dbl = 10000510.0997;

        decimal dec = Convert.ToDecimal(dbl);

        Console.WriteLine(dec);
    }
}




/*
run:

10000510.0997

*/

 



answered Nov 16, 2021 by avibootz
edited Nov 16, 2021 by avibootz

Related questions

1 answer 132 views
1 answer 173 views
3 answers 333 views
3 answers 307 views
...