I have a dictionary which stores method call results. The Dictionary key is the method call signature i.e. an object with the following members.
string _name,
Type[] _argTypes,
string[] _argNames,
object[] _argValues.
I must override the GetHashCode method for the TryGetValue to compare correctly. What is the most efficient way to compare the method signatures? i.e. the 4 parameters above.
e.g. this does not seem efficient to me.
public override int GetHashCode()
{
if(_name!=null)
_hashCode = _name.GetHashCode();
if (_argTypes != null)
{
foreach (object value in _argTypes)
_hashCode ^= value.GetHashCode();
}
if (_argNames != null)
{
foreach (object value in _argNames)
_hashCode ^= value.GetHashCode();
}
if (_argValues != null)
{
foreach (object value in _argValues)
_hashCode ^= value.GetHashCode();
}
}