ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

ToInt32

Convert string to int32

Source

public static int ToInt32(this string value)
{
    int number;

    Int32.TryParse(value, out number);

    return number;
}

Example

string number = "1";
int converted = number.ToInt32();

Author: Túlio Henrique Thomé

Submitted on: 17 mei 2011

Language: C#

Type: System.String

Views: 6139