Hi I am trying to add in IEquatable to my program and I have no clue if I need to add a unique id basicly and a hashcode? They are using the shd number as a unique id in the IEquatable but they give the value to it in the constructor and I asked on this site if the constructor was needed to look like it does in the documentation and I got a no. So now I am confused can someone give me an easier example of IEquatable then the documentation does? here is the link for the documentation https://learn.microsoft.com/en-us/dotnet/api/system.iequatable-1?view=netcore-3.1 I am just trying to get contains for a custom object list to work.
My code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataConverter.Objects
{
public class Category : IEquatable<Category>
{
public string _Name { get; set; }
public string _Id { get; set;}
private string _HomeCategory { get; set; }
public string _prestaId { get; set; }
public bool _inUse { get; set; }
public Category(string Name, string Id, string HomeCategory, bool inUse)
{
_Name = Name;
_Id = Id;
_HomeCategory = HomeCategory;
_inUse = inUse;
}
public bool Equals(Category other)
{
if (other == null)
return false;
if()
}
}
}