void CreateCompareMethod(List <PropertySerializationInfo> properties) { const string endFalseLabel = "compareFailedLabel"; DynamicMethodHelper il = new DynamicMethodHelper( "Compare_" + type.Name, typeof(bool), new Type[] { typeof(object), typeof(object) }, this.type ); // Create calls to compare each member foreach (PropertySerializationInfo propInfo in properties) { il.BeginScope(); propInfo.GenerateCompareIL(il, 0, 1); il.EndScope(); il.GotoIfFalse(endFalseLabel); } // Return true if all properties passed (didn't goto endFalseLabel) il.PushInt(Convert.ToInt32(true)); il.Return(); // Return false if any properties failed (did goto endFalseLabel) il.MarkLabel(endFalseLabel); il.PushInt(Convert.ToInt32(false)); il.Return(); this.compareMethod = (CompareMethod)il.Compile(typeof(CompareMethod)); }