Convert String to int

Hi ,

I have a cavas with an inputField, But i want to store the string of the inputfield into an int. ( lets say the strings is “10” , I want that string to be converted to an int)
I’ve found some solution on the internet about a function called convert.int32(string) but whenever i type the function’ Convert’ into monoDevelop it doesn’t recognize it. Maybe I explained it bad , but here is the code i’m struggling with :

public List<int> WageOfPlayer = new List<int> ();
public List <InputField> AmountOfCoins = new List<InputField> ();

void Start () {

	WageOfPlayer [0] = AmountOfCoins [0].text;

// I want to convert the text of amount of coins into an int so that i can store it in the WageOfPlayer list so i can make calculations with it

}

Thank you in advance.

To use Convert.ToInt32 method you should either use system:

    using System;

    //and then:
    Convert.ToInt32(yourString);

or if you don’t want then you can just call it like that:

    System.Convert.ToInt32(yourString);

Also you can use int.Parse, or int.TryParse (especially if you’re not sure what user can input and you haven’t bothered to check before parsing).