public override bool Equals(object obj)
        {
            if (!(obj is IdentityDefinition))
            {
                return(false);
            }

            IdentityDefinition defToCompare = (IdentityDefinition)obj;

            // Part length must match
            if (defToCompare.PartDefinitions.Length != this.PartDefinitions.Length)
            {
                return(false);
            }

            // Compare the order of the parts and their values
            for (int i = 0; i < this.PartDefinitions.Length; i++)
            {
                if (!Object.Equals(this.PartDefinitions[i], defToCompare.PartDefinitions[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
        public Identity(IdentityDefinition definition, IdentityPart[] parts)
        {
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }

            if (parts == null || parts.Length < 1)
            {
                throw new ArgumentException("Parts cannot be null or zero length", "parts");
            }

            this.IdentityDefinition = definition;
            this.Parts = new IdentityPart[parts.Length];
            parts.CopyTo(Parts, 0);

            var hashinput = new object[parts.Length + 1];

            hashinput[0] = definition;
            parts.CopyTo(hashinput, 1);
            _hash = HashingHelper.Hash(hashinput);
        }