C# में दशमलव को Int64 (लंबे) में बदलने के लिए Convert.ToInt64 () विधि का उपयोग करें।
मान लें कि हमारे पास एक दशमलव चर है।
decimal d = 310.23m;
अब इसे Int64 में बदलने के लिए Convert.ToInt64() विधि का उपयोग करें।
long res; res = Convert.ToInt64(d);
आइए एक और उदाहरण देखें -
उदाहरण
using System;
class Demo {
static void Main() {
decimal d = 190.66m;
long res;
res = Convert.ToInt64(d);
Console.WriteLine("Converted Decimal '{0}' to Int64 value {1}", d, res);
}
} आउटपुट
Converted Decimal '190.66' to Int64 value 191