The 1.convert.toint32 and the int32.parse of the enmity
3 Ways to use 2.Split
3.@ the difference between "ABC" and "ABC" Is there
4. Keep 2-digit valid decimal and rounding
5.url Solution for delivering Chinese
6.3 Ways to convert 123456789 to 12-345-6789
7.4 ways to swap two characters at a specified location
8. The magical uses of "%10"
9. The ingenious way to output 21 aaaaaaaaaaaaaaaaaaaaa
The 1.convert.toint32 and the int32.parse of the enmity
All 2 of these methods can parse string to int, then we must have a question: what is the difference between them? When should I use what? Performance and so on.
In fact, in 2.0 and Int32.TryParse also achieved the same effect.
C # CODE
using System;using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
...
{
class Program
...
{
static void Main(string[] args)
...
{
string myString = "1234";
int myint = 0;
myint = Convert.ToInt32(myString);
Console.Write(myint+"\r\n ");
myint = Int32.Parse(myString);
Console.Write(myint+"\r\n ");
Int32.TryParse(myString, out myint);
Console.Write(myint+"\r\n");
}
}}
(The running effect will be no different, Tullo)