Dy Oswald

Dy Oswald

  • NA
  • 6
  • 0

String parameter is not equal

Jul 11 2007 10:19 AM

I write a function that passes a string parameter to my ws and return the hash code of that parameter.
But when I compare it to the hash code of the original string in my client-side code, they were not equal.
Could anybody help me please?

WS Code:
[WebMethod]
public int MyWebFunction(string data)
{
   int retVal = data.GetHashCode();

   ... rest of my code ...

   return retVal;
}


Client-Side Code:
public bool DataUploader(string data)
{
   bool retVal;
   int hashCode;
   
   MyWebService ws = new MyWebService();
   hashCode = ws.MyWebFunction(data);

   if (hashCode == data.GetHashCode())
   {
      retVal = true;
   }
   else
   {
      retVal = false;
   }

   return retVal;
}

Why does it always returns false?


Answers (2)