# Acumatica and ObjectsEqual lack of parameters

Hello everybody,

today I want to share how I deal with ObjectsEqual limitation. In one of my tasks I had requirement to check for equality more then eight parameters and found that ObjectsEqual takes only 8 parameters. But I needed more.

In order to fix it I decided to use extension classes of C# which allows inject into existing class new functionality.

Here is the way how I did it:

public static class PXCacheExtensions { public static bool ObjectsEqualExt(this PXCache cache, object a, object b, params IBqlField[] values) { var result = true; foreach (var bqlField in values) { result = result && object.Equals(cache.GetValue<IBqlField>(a), cache.GetValue<IBqlField>(b)); } return result; } public static bool ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9>(this PXCache cache, object a, object b) where Field1 : IBqlField where Field2 : IBqlField where Field3 : IBqlField where Field4 : IBqlField where Field5 : IBqlField where Field6 : IBqlField where Field7 : IBqlField where Field8 : IBqlField where Field9 : IBqlField { return (cache.ObjectsEqual<Field9>(a, b) && cache.ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8>(a, b)); } public static bool ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10>(this PXCache cache, object a, object b) where Field1 : IBqlField where Field2 : IBqlField where Field3 : IBqlField where Field4 : IBqlField where Field5 : IBqlField where Field6 : IBqlField where Field7 : IBqlField where Field8 : IBqlField where Field9 : IBqlField where Field10 : IBqlField { return (cache.ObjectsEqual<Field10>(a, b) && cache.ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9>(a, b)); } public static bool ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10, Field11>(this PXCache cache, object a, object b) where Field1 : IBqlField where Field2 : IBqlField where Field3 : IBqlField where Field4 : IBqlField where Field5 : IBqlField where Field6 : IBqlField where Field7 : IBqlField where Field8 : IBqlField where Field9 : IBqlField where Field10 : IBqlField where Field11 : IBqlField { return (cache.ObjectsEqual<Field11>(a, b) && cache.ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10>(a, b)); } public static bool ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10, Field11, Field12>(this PXCache cache, object a, object b) where Field1 : IBqlField where Field2 : IBqlField where Field3 : IBqlField where Field4 : IBqlField where Field5 : IBqlField where Field6 : IBqlField where Field7 : IBqlField where Field8 : IBqlField where Field9 : IBqlField where Field10 : IBqlField where Field11 : IBqlField where Field12 : IBqlField { return (cache.ObjectsEqual<Field12>(a, b) && cache.ObjectsEqual<Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, Field9, Field10, Field11>(a, b)); } }

After those modifications my cache accepts twelve parameters for comparing