Any performance difference between int.Parse() and Convert.Toint()?

c#, performance

Solution

When passed a string as a parameter, Convert.ToInt32 calls int.Parse internally. So the only difference is an additional null check.

Here's the code from .NET Reflector

public static int ToInt32(string value)
{
    if (value == null)
    {
        return 0;
    }
    return int.Parse(value, CultureInfo.CurrentCulture);
}

Problem

Is there any significant advantages for converting a string to an integer value between int.Parse() and Convert.ToInt32() ? ``` string stringInt = "01234"; int iParse = int.Parse(stringInt); int iConvert = Convert.ToInt32(stringInt); ``` I found a question asking about casting vs Convert but I think this is different, right?

Original source