Current filter:
                                You should refresh the page.
                                  • Seems like the 'Implement IEquatable' refactoring in CodeRush for Roslyn doesn't work.  In an example class I have it generates this:

                                    [C#]
                                    public class FacilityCfg : IEquatable<FacilityCfg> { public string FacId { get; set; } public int DataVer { get; set; } public int DelFlg { get; set; } public string OrderCdFmt { get; set; } public string AllowAbsOrder { get; set; } public string AllowBookingOrder { get; set; } public FacilityCfg() { FacId = ""; OrderCdFmt = ""; AllowAbsOrder = "N"; AllowBookingOrder = "N"; } public override string ToString() { return string.Format("{0} (DataVer:{2}{3})", FacId, DataVer, DelFlg == 1 ? "DELETED" : ""); } public override bool Equals(object obj) { if (obj is FacilityCfg) return Equals((FacilityCfg)obj); return base.Equals(obj); } public static bool operator ==(FacilityCfg first, FacilityCfg second) { if ((object)first == null) return (object)second == null; return first.Equals(second); } public static bool operator !=(FacilityCfg first, FacilityCfg second) { return !(first == second); } public bool Equals(FacilityCfg other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return false; } public override int GetHashCode() { unchecked { var hashCode = 47; return hashCode; } } } }

                                    However, classing CodeRush generated this:

                                    [C#]
                                    public override bool Equals(object obj) { if (obj is FacilityCfg) return Equals((FacilityCfg)obj); return base.Equals(obj); } public static bool operator ==(FacilityCfg first, FacilityCfg second) { if ((object)first == null) return (object)second == null; return first.Equals(second); } public static bool operator !=(FacilityCfg first, FacilityCfg second) { return !(first == second); } public bool Equals(FacilityCfg other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(this.FacId, other.FacId) && this.DataVer.Equals(other.DataVer) && this.DelFlg.Equals(other.DelFlg) && Equals(this.OrderCdFmt, other.OrderCdFmt) && Equals(this.AllowAbsOrder, other.AllowAbsOrder) && Equals(this.AllowBookingOrder, other.AllowBookingOrder); } public override int GetHashCode() { unchecked { int hashCode = 47; if (this.FacId != null) hashCode = (hashCode * 53) ^ this.FacId.GetHashCode(); hashCode = (hashCode * 53) ^ this.DataVer.GetHashCode(); hashCode = (hashCode * 53) ^ this.DelFlg.GetHashCode(); if (this.OrderCdFmt != null) hashCode = (hashCode * 53) ^ this.OrderCdFmt.GetHashCode(); if (this.AllowAbsOrder != null) hashCode = (hashCode * 53) ^ this.AllowAbsOrder.GetHashCode(); if (this.AllowBookingOrder != null) hashCode = (hashCode * 53) ^ this.AllowBookingOrder.GetHashCode(); return hashCode; } }

                                    Seems like a problem to me - by maybe I've got something configured wrong?  I have latest versions of both Editions of CodeRush.

                                • Dmitry O (DevExpress) 08.12.2016

                                  Hi Nicholas,
                                  Thank you for code snippets.
                                  I have reproduced the problem for the following source class.

                                  [C#]
                                  namespace NamespaceName { public class FacilityCfg { public string FacId { get; set; } public int DataVer { get; set; } public int DelFlg { get; set; } public string OrderCdFmt { get; set; } public string AllowAbsOrder { get; set; } public string AllowBookingOrder { get; set; } public FacilityCfg() { FacId = ""; OrderCdFmt = ""; AllowAbsOrder = "N"; AllowBookingOrder = "N"; } public override string ToString() { return string.Format("{0} (DataVer:{2}{3})", FacId, DataVer, DelFlg == 1 ? "DELETED" : ""); } } }

                                  We will try to fix it as soon as possible. Once we make any progress, we will let you know.

                                1 Solution

                                Creation Date Importance Sort by

                                Fixed: