কম্পিউটার টিউটোরিয়াল

C#-এ OverflowException: ইন্টিজার রেঞ্জ বাইরে মান

OverflowException থ্রো হয় যখন একটি মান টার্গেট টাইপের রেঞ্জের বাইরে চলে যায় (যেমন int.Parse এ খুব বড় স্ট্রিং)।

উদাহরণ

using System;

class Demo
{
    static void Main()
    {
        string str = "757657657657657";
        int res = int.Parse(str); // OverflowException
    }
}

আউটপুট (এরর)

Unhandled Exception: System.OverflowException: Value was either too large or too small for an Int32.

প্রিভেনশন: long.Parse, BigInteger, বা int.TryParse ব্যবহার করুন। checked/unchecked কনটেক্সট কন্ট্রোল করে।

  1. HTML value অ্যাট্রিবিউট

  2. C#-এ bool ডিফল্ট ভ্যালু

  3. C#-এ StringBuilder ডিফল্ট ভ্যালু

  4. C#-এ ভ্যালু টাইপ বনাম রেফারেন্স টাইপ (Value Type vs Reference Type)