converting string to int, without assuming int32

  • Thread starter Thread starter titan nyquist
  • Start date Start date
T

titan nyquist

To convert a string to an int, I used:

int integer;
string str;
integer = Convert.ToInt32(str);

But, that assumes int = int32.

Is there a method that matches whatever "int" is, instead of assuming
it is int32?

Titan
 
titan said:
To convert a string to an int, I used:

int integer;
string str;
integer = Convert.ToInt32(str);

But, that assumes int = int32.

Is there a method that matches whatever "int" is, instead of assuming
it is int32?

C# language spec says that 'int' is synonymous with Int32. 'int' doesn't
change size like in e.g. C.

-- Barry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top