From Names of Type Members on MSDN:
Do give methods names that are verbs or verb phrases. Typically methods act on data, so using a verb to describe the action of the method makes it easier for developers to understand what the method does. When defining the action performed by the method, be careful to select a name that provides clarity from the developer's perspective. Do not select a verb that describes how the method does what it does; in other words, do not use implementation details for your method name.
Do name Boolean properties with an affirmative phrase (CanSeek instead of CantSeek). Optionally, you can also prefix Boolean properties with Is, Can, or Has, but only where it adds value.
I think others will agree that any naming convention is good as long as it makes sense and you use it consistently.
Alternatively, consider creating an extension method for the string
class that provides this functionality. Then you can simply do:
var equal = h1.EqualsHash(h2); // or similar, based on the naming you choose
Or write a custom Hash
class that keeps the hashed values internally, and override/overload its Equals
method and ==
/!=
operator(s), giving way to this:
var h1 = new Hash("string1");
var h2 = new Hash("string2");
var equal = h1 == h2;
// or
var equal = h1.Equals(h2);
Or make your utility class stand alone (e.g. HashUtil
or something), and keep the word "hash" out of its method(s) entirely:
var equal = HashUtil.AreEqual(h1, h2);
Also see: Guidelines for Names