convert string to another type

  • Thread starter Thread starter winthux
  • Start date Start date
W

winthux

How can I convert string i.e. to integer or to unsigned integer, or to other
types?
 
winthux said:
How can I convert string i.e. to integer or to unsigned integer, or to other
types?

Look at the Convert class, and also things like Int32.Parse,
UInt32.Parse etc.
 
Yes, it's actually a piece of cake:

int a = int.Parse("-5");
int b = Convert.ToInt32("7");
 

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

Back
Top