views:

212

answers:

4

how to declare int1024 in C#? i can use VB or C++ Too.

Regards
Behrooz

+7  A: 

See this question: http://stackoverflow.com/questions/176775/big-integers-in-c

From the answer to that question:

MS is going to introduce System.Numerics.BigInteger class in .NET 4.0

Until then, look at IntX class.

IntX is an arbitrary precision integers library written in pure C# 2.0 with fast - O(N * log N) - multiplication/division algorithms implementation. It provides all the basic operations on integers like addition, multiplication, comparing, bitwise shifting etc.

Matthew Scharley
A: 

If I understand you correctly you want a 1024 bit integer.

Unfortunately there is no inbuilt 1024 bit integer type in .net. You would have to find a specialised library for that kind of thing or write one yourself.

There is an article about big integers here.

Simon P Stevens
+3  A: 

And by that do you mean a 1024-bit integer? Better wait until BigInteger in 4.0. Until then, the cheekiest you can do with the core libraries is to (ab)use decimal, which has 96 bits for the integer part. Or use a 3rd-party dll.

Marc Gravell
+2  A: 

Just for avoidance of doubt:

public int int1024 = 1024;
Denk Hanners
Haha, that's funny.
Romain Verdier
it is the most funny thing i have seen this month!!!believe me.
Behrooz