User guide
Table Of Contents
- AWS SDK for .NET
- Table of Contents
- AWS SDK for .NET Developer Guide
- Getting Started with the AWS SDK for .NET
- Programming with the AWS SDK for .NET
- AWS SDK for .NET Tutorials and Examples
- Managing ASP.NET Session State with Amazon DynamoDB
- Tutorial: Creating Amazon EC2 Instances with the AWS SDK for .NET
- Tutorial: Grant Access Using an IAM Role and the AWS SDK for .NET
- Tutorial: Amazon EC2 Spot Instances
- Creating and Using an Amazon SQS Queue with the AWS SDK for .NET
- Creating an Amazon Route 53 Hosted Zone and Adding Resource Record Sets
- Additional Resources
- Document History

callback function uses the Amazon S3 client object to call the EndPutObject method to retrieve the
server response. The callback also extracts the start time for the operation and uses it to print the time
it took for the asynchronous operation to complete.
As in the previous examples, because exceptions that occur during the operation are received when En-
dPutObject is called, this call is placed within a try block.
asyncResult = client.BeginPutObject(
request, CallbackWithState, new ClientState { Client = client, Start = Date
Time.Now } );
Complete Sample
The following code sample demonstrates the various patterns that you can use when calling the asyn-
chronous request methods.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using Amazon;
using Amazon.Runtime;
using Amazon.S3;
using Amazon.S3.Model;
namespace async_aws_net
{
class ClientState
{
AmazonS3Client client;
DateTime startTime;
public AmazonS3Client Client
{
get { return client; }
set { client = value; }
}
public DateTime Start
{
get { return startTime; }
set { startTime = value; }
}
}
class Program
{
public static void Main(string[] args)
{
TestPutObjectAsync();
}
public static void SimpleCallback(IAsyncResult asyncResult)
Version v2.0.0
21
AWS SDK for .NET Developer Guide
Asynchronous API for .NET 3.5