I have a property that returns System.Numerics.BigInteger. When I casting the property to int, I got this error.
Cannot convert type 'System.Numerics.BigInteger' to 'int'
How can I convert int to/from System.Numerics.BigInteger in C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The conversion from BigInteger to Int32 is explicit, so just assigning a
BigIntegervariable/property to anintvariable doesn’t work:This works (although it might throw an exception at runtime if the value is too large to fit in the
intvariable):Note that, if the
BigIntegervalue is boxed in anobject, you cannot unbox it and convert it tointat the same time:This works: