Why would myString.Contains(" ") or myString.IndexOf(' ') throw a FormatException “Invalid name format”? This exception is only thrown when there is a space in myString.
Why would myString.Contains( ) or myString.IndexOf(‘ ‘) throw a FormatException Invalid name format? This
Share
Looking at the MSDN pages for the
string.Containsandstring.IndexOfmethods clearly shows that neither of these methods ever throws aFormatException.I can only conclude that it must be another part of the code (possibly a call to
string.Format?) throwing this exception. Perhaps posting the relevant section of code would help?