C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 8)
8.
Which of the following snippets are the correct way to convert a Single into a String?
  1. Single f = 9.8f; 
    String s;
    s = (String) (f);
  2. Single f = 9.8f; 
    String s;
    s = Convert.ToString(f);
  3. Single f = 9.8f; 
    String s;
    s = f.ToString();
  4. Single f = 9.8f; 
    String s;
    s = Clnt(f);
  5. Single f = 9.8f; 
    String s;
    s = CString(f);
1, 2
2, 3
1, 3, 5
2, 4
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
2 comments Page 1 of 1.

Santhosh said:   10 years ago
Can you please explain this?

Naga said:   9 years ago
Both are same convert. Tostring is not allow null values, f.Tostring is allow null values.

Post your comments here:

Your comments will be displayed after verification.