You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ShopNCook/Models/User.cs

49 lines
1.1 KiB

using System.Runtime.Serialization;
namespace Models
{
/// <summary>
/// Publics informations of a user
/// </summary>
[DataContract]
public class User
{
/// <summary>
/// The profile picture
/// </summary>
[DataMember]
public Uri ProfilePicture { get; init; }
/// <summary>
/// The username
/// </summary>
[DataMember]
public string Name { get; init; }
/// <summary>
/// An unique identifier
/// </summary>
[DataMember]
public Guid Id { get; init; }
public User(Uri profilePicture, string name, Guid id)
{
ProfilePicture = profilePicture;
Name = name;
Id = id;
}
public override bool Equals(object? other)
{
if (this == other)
return true;
User? otherUser = other as User;
return otherUser != null && Id.Equals(otherUser.Id);
}
override public int GetHashCode()
{
return Id.GetHashCode();
}
}
}