Files
Orchard/src/Orchard/Utility/Hash.cs
2010-07-29 17:44:15 -07:00

26 lines
737 B
C#

using System;
namespace Orchard.Utility {
/// <summary>
/// Compute an (almost) unique hash value from various sources.
/// This allows computing hash keys that are easily storable
/// and comparable from heterogenous components.
/// </summary>
public class Hash {
private long _hash;
public string Value { get { return _hash.ToString(); } }
public void AddString(string value) {
if ( string.IsNullOrEmpty(value) )
return;
_hash += value.GetHashCode();
}
public void AddTypeReference(Type type) {
AddString(type.AssemblyQualifiedName);
AddString(type.FullName);
}
}
}