/// <summary> /// Creates a new Container and returns it. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='newItem'> /// Definition of how the Container will be created. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ContainerModel> CreateAsync(this IContainers operations, NewContainerModel newItem, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(newItem, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates a new Container and returns it. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='newItem'> /// Definition of how the Container will be created. /// </param> public static ContainerModel Create(this IContainers operations, NewContainerModel newItem) { return(Task.Factory.StartNew(s => ((IContainers)s).CreateAsync(newItem), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }