I was looking through some source code for a class I was using, and found the following block of code:
if (provider.Equals("LOADEXTPROVIDER"))
{
OutputLine(" Assembly: " +
providerAssembly);
OutputLine(" Connection Class: " +
providerConnectionClass);
}
Now, the .Equals method has several overloads that take care of a variety of other potential tasks, but can anyone tell me why you would want to use this method for a textual comparison? Why not simply:
if(provider == "LOADEXTPROVIDER")
Are we just trying to accomodate varying coding styles, since we’re creating the method for other purposes as well? Is there actually a language out there that doesn’t support == (or simply = in farked up languages like Delphi)?