Skip to content
Discussion options

You must be logged in to vote
public record Person
{
    public string FirstName { get; init; }
    public string LastName { get; init; }
    public byte[] Data { get; init; }

    // you can customize the equality by
    public virtual bool Equals(Person other)
    {
        return other != null
            && FirstName == other.FirstName
            && LastName == other.LastName
            && new BigInteger(Data) == new BigInteger(other.Data);
    }

    public override int GetHashCode()
    {
        unchecked
        {
            const int HashingBase = (int)2166136261;
            const int HashingMultiplier = 16777619;

            int hash = HashingBase;
            hash = (hash * HashingMultiplier) ^ FirstName.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tmccowan
Comment options

Answer selected by tmccowan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants