C# में Decimal को Int64 (long) में बदलने के लिए 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("डेसीमल '{0}' को Int64 मान {1} में परिवर्तित किया गया", d, res); } }आउटपुट
डेसीमल '190.66' को Int64 मान 191 में परिवर्तित किया गया