C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 10)
10.
Which of the following is correct way to convert a String to an int?
  1. String s = "123"; 
    int i;
    i = (int)s;
  2. String s = "123";
    int i;
    i = int.Parse(s);
  3. String s = "123"; 
    int i;
    i = Int32.Parse(s);
  4. String s = "123"; 
    int i;
    i = Convert.ToInt32(s);
  5. String s = "123"; 
    int i;
    i = CInt(s);
1, 3, 5
2, 4
3, 5
2, 3, 4
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.