summaryrefslogtreecommitdiff
path: root/external/aspnetwebstack/src/System.Net.Http.Formatting/Internal/AsyncResultWithExtraData.cs
blob: d1679034ce88278b19d6c35d12574c1eece771cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.

namespace System.Net.Http.Internal
{
    // Wrapper around async result to store additional data. This is useful to pass data between BeginXYZ / EndXYZ. 
    internal class AsyncResultWithExtraData<T> : IAsyncResult
    {
        public AsyncResultWithExtraData(IAsyncResult inner, T extraData)
        {
            Inner = inner;
            ExtraData = extraData;
        }

        public IAsyncResult Inner { get; private set; }

        public T ExtraData { get; private set; }

        public object AsyncState
        {
            get { return Inner.AsyncState; }
        }

        public Threading.WaitHandle AsyncWaitHandle
        {
            get { return Inner.AsyncWaitHandle; }
        }

        public bool CompletedSynchronously
        {
            get { return Inner.CompletedSynchronously; }
        }

        public bool IsCompleted
        {
            get { return Inner.IsCompleted; }
        }
    }
}