When the application runs, the IDE tells me Input string is not in the correct format.
(Convert.ToInt32(_subStr.Reverse().ToString().Substring(4, _subStr.Length - 4))*1.6).ToString()
I don’t know how the Reverse() can be exactly used here.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no
Reversemethod in theStringclass, so the method you’re using is actually theEnumerable.Reverseextension method. This compiles becauseStringimplementsIEnumerable<char>, but the result is not a string, it’s another implementation ofIEnumerable<char>. When you callToString()on that, you get this:System.Linq.Enumerable+<ReverseIterator>d__a01[System.Char]`.If you want to convert this
IEnumerable<char>to a string, you can dot it like this:Note, however, that it is not a correct way of reversing a string, it will fail in some cases due to Unicode surrogate pairs and combining characters. See here and there for explanations.