Ejemplo n.º 1
0
        public static Task PackToArrayAsync <TObject>(
            Packer packer,
            TObject target,
            IList <Func <Packer, TObject, CancellationToken, Task> > operations,
            CancellationToken cancellationToken
            )
        {
            if (packer == null)
            {
                SerializationExceptions.ThrowArgumentNullException("packer");
            }

            if (operations == null)
            {
                SerializationExceptions.ThrowArgumentNullException("operations");
            }

            var parameter =
                new PackToArrayAsyncParameters <TObject>
            {
                Packer            = packer,
                Target            = target,
                Operations        = operations,
                CancellationToken = cancellationToken
            };

            return(PackToArrayAsync(ref parameter));
        }
Ejemplo n.º 2
0
        public static Task PackToArrayAsync <TObject>(
            ref PackToArrayAsyncParameters <TObject> parameter
            )
        {
            if (parameter.Packer == null)
            {
                SerializationExceptions.ThrowArgumentNullException("parameter", "Packer");
            }

            if (parameter.Operations == null)
            {
                SerializationExceptions.ThrowArgumentNullException("parameter", "Operations");
            }

            return(PackToArrayAsyncCore(parameter.Packer, parameter.Target, parameter.Operations, parameter.CancellationToken));
        }