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

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

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

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

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

            return(PackToMapAsyncCore(parameter.SerializationContext, parameter.Packer, parameter.Target, parameter.Operations, parameter.NullCheckers, parameter.CancellationToken));
        }