Best Overloaded match has some invalid arguments: string.Replace

Why is the following acceptable to Visual Studio 2005:

   string tmp = tf.InputField.Name;
   if (tmp.Replace(" ", string.Empty) == "xyz") {
      string x = string.Empty;

But this produces a best overloaded match error:

   if (tf.InputField.Name.Replace(" ", string.Empty) == "xyz") {
      string x = string.Empty;

tf.InputField.Name is of type string.

I've tried casting variations and using "" instead of string.Empty but still no luck.

Thanks in advance.
Who is Participating?
ZekeLAConnect With a Mentor Author Commented:
The problem was other variables not declared properly, I believe. Once I cleaned them up, the following statement worked"

   if (tf.InputField.Name.Replace(" ", "") == "xyz")
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.