public static void PackToArray <TObject>( Packer packer, TObject target, IList <Action <Packer, TObject> > operations ) { if (packer == null) { SerializationExceptions.ThrowArgumentNullException("packer"); } if (operations == null) { SerializationExceptions.ThrowArgumentNullException("operations"); } var parameter = new PackToArrayParameters <TObject> { Packer = packer, Target = target, Operations = operations }; PackToArray(ref parameter); }
public static void PackToArray <TObject>( ref PackToArrayParameters <TObject> parameter ) { if (parameter.Packer == null) { SerializationExceptions.ThrowArgumentNullException("parameter", "Packer"); } if (parameter.Operations == null) { SerializationExceptions.ThrowArgumentNullException("parameter", "Operations"); } #if ASSERT Contract.Assert(parameter.Packer != null); Contract.Assert(parameter.Operations != null); #endif // ASSERT parameter.Packer.PackArrayHeader(parameter.Operations.Count); foreach (var operation in parameter.Operations) { operation(parameter.Packer, parameter.Target); } }