You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 21, 2023. It is now read-only.
The `EquatableSourceGenerator` will generate a partial class of `DummyModel`. It will like that:
usingSystem;namespaceEquatableSourceGenerator.Sample.Models{partialclassDummyModel{publicboolEquals(DummyModel?other){returnotheris not null/*&& All your properties*/;}publicoverrideboolEquals(object?obj){if(ReferenceEquals(null,obj))returnfalse;if(ReferenceEquals(this,obj))returntrue;returnobj.GetType()==this.GetType()||objisDummyModelself&&Equals(self);}publicoverrideintGetHashCode(){HashCodehashCode=new();/*&& hashCode will add all your properties*/;returnhashCode.ToHashCode();}publicstaticbooloperator==(DummyModel?self,DummyModel?other){returnother?.Equals(self)??selfisnull;}publicstaticbooloperator!=(DummyModel?self,DummyModel?other){return!(self==other);}}}
About
The `EquatableSourceGenerator` is a simple generator that realize the implementation of the interface IEquatable`1 in a partial class