Skip to content

Commit 997f9e1

Browse files
committed
public/private sync
2 parents 4cab272 + 962d114 commit 997f9e1

63 files changed

Lines changed: 380 additions & 1122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docfx.json

Lines changed: 122 additions & 1032 deletions
Large diffs are not rendered by default.

windows.foundation.collections/ikeyvaluepair_2.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ public interface IKeyValuePair<K, V> :
1313

1414
Represents a key-value pair. This is typically used as a constraint type when you need to encapsulate two type parameters into one to satisfy the constraints of another generic interface.
1515

16-
> **.NET**
17-
> This interface appears as [System.Collections.Generic.KeyValuePair&lt;TKey,TValue&gt;](/dotnet/api/system.collections.generic.keyvaluepair-2?view=dotnet-uwp-10.0&preserve-view=true) (a structure, not an interface). In any case where a Windows Runtime type has implemented IKeyValuePair&lt;K,V&gt;, .NET code can use the APIs of [KeyValuePair](/dotnet/api/system.collections.generic.keyvaluepair-2?view=dotnet-uwp-10.0&preserve-view=true) instead.
16+
> [!NOTE]
17+
> In .NET, this interface appears as [System.Collections.Generic.KeyValuePair&lt;TKey,TValue&gt;](/dotnet/api/system.collections.generic.keyvaluepair-2?view=dotnet-uwp-10.0&preserve-view=true) (a structure, not an interface). In any case where a Windows Runtime type has implemented IKeyValuePair&lt;K,V&gt;, .NET code can use the APIs of [KeyValuePair](/dotnet/api/system.collections.generic.keyvaluepair-2?view=dotnet-uwp-10.0&preserve-view=true) instead.
1818
1919
## -remarks
2020

2121
When programming with .NET, this interface is hidden and developers should use the [System.Collections.Generic.KeyValuePair&lt;TKey,TValue&gt;](/dotnet/api/system.collections.generic.keyvaluepair-2?view=dotnet-uwp-10.0&preserve-view=true) structure. In any case where a Windows Runtime type has implemented IKeyValuePair&lt;K,V&gt;, including when interfaces have inherited IKeyValuePair&lt;K,V&gt; or used it as an inner constraint, .NET code can treat it as a .NET [KeyValuePair](/dotnet/api/system.collections.generic.keyvaluepair-2?view=dotnet-uwp-10.0&preserve-view=true).
2222

23-
Key-value pairs are used in the [IMap<K,V>](imap_2.md) interface, when it inherits [IIterable<T>](iiterable_1.md). Practical implementations of [IMap<K,V>](imap_2.md) are iterable, and iterating or calling [First](iiterable_1_first_1920739956.md)/[Current](iiterator_1_current.md) explicitly will return instances of IKeyValuePair&lt;K,V&gt; using the same constraints as does the [IMap<K,V>](imap_2.md) implementation.
23+
Key-value pairs are used in the [IMap&lt;K,V&gt;](imap_2.md) interface, when it inherits [IIterable&lt;T&gt;](iiterable_1.md). Practical implementations of [IMap&lt;K,V&gt;](imap_2.md) are iterable, and iterating or calling [First](iiterable_1_first_1920739956.md)/[Current](iiterator_1_current.md) explicitly will return instances of IKeyValuePair&lt;K,V&gt; using the same constraints as does the [IMap&lt;K,V&gt;](imap_2.md) implementation.
2424

2525
### C++/WinRT extension functions
2626

@@ -47,10 +47,10 @@ is equivalent to,
4747
auto key = kvp.Key();
4848
auto value = kvp.Value();
4949
```
50-
50+
5151
Structured binding is particularly convenient in range-based `for` loops, letting you iterate through the key/value pairs of a map.
5252

53-
```cppwinrt
53+
```cppwinrt
5454
winrt::Windows::Foundation::Collections::IMap<K, V> map;
5555
for (auto&& [key, value] : map) { ... }
5656
```

windows.foundation/iasyncaction.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,44 @@ public interface IAsyncAction : Windows.Foundation.IAsyncInfo
1010
# Windows.Foundation.IAsyncAction
1111

1212
## -description
13-
Represents an asynchronous action. This is the return type for many Windows Runtime asynchronous methods that don't have a result object, and don't report ongoing progress.
13+
14+
Represents an asynchronous action. This is the return type for many Windows Runtime (WinRT) asynchronous methods that don't have a result object, and don't report ongoing progress.
1415

1516
## -remarks
16-
IAsyncAction is the return type for all Windows Runtime asynchronous methods that don't communicate a result object, or ongoing progress. This constitutes over 300 different Windows Runtime APIs. APIs that do report progress (but don't have a result) use another interface, [IAsyncActionWithProgress<TProgress>](iasyncactionwithprogress_1.md).
1717

18-
When you use methods that return IAsyncAction in your app code, you usually don't access the IAsyncAction return value directly. That's because you almost always use the language-specific awaitable syntax. In this case, the apparent return value of the method is **void**. For more info, see [Asynchronous programming](/windows/uwp/threading-async/asynchronous-programming-universal-windows-platform-apps), or one of the language-specific guides to Windows Runtime asynchronous programming ([Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic), [C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps), [JavaScript](/previous-versions/windows/apps/hh700330(v=win.10))).
18+
`IAsyncAction` is the return type for all WinRT asynchronous methods that don't communicate a result object, or ongoing progress. This constitutes over 300 different WinRT APIs. APIs that report progress but don't have a result use another interface, [IAsyncActionWithProgress&lt;TProgress&gt;](iasyncactionwithprogress_1.md).
19+
20+
When you use methods that return `IAsyncAction` in your app code, you usually don't access the `IAsyncAction` return value directly. That's because you almost always use the language-specific awaitable syntax. In this case, the apparent return value of the method is **void**. For more info, see [Asynchronous programming](/windows/uwp/threading-async/asynchronous-programming-universal-windows-platform-apps), or one of the language-specific guides to WinRT asynchronous programming ([Call asynchronous APIs in C# or Visual Basic](/windows/uwp/threading-async/call-asynchronous-apis-in-csharp-or-visual-basic), [C++](/windows/uwp/threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps), [JavaScript](/previous-versions/windows/apps/hh700330(v=win.10))).
21+
22+
`IAsyncAction` is also an input type for some advanced-scenario utility APIs such as [CoreDispatcher.RunAsync](../windows.ui.core/coredispatcher_runasync_447339746.md) and [ThreadPool.RunAsync](../windows.system.threading/threadpool_runasync_514988780.md).
1923

20-
IAsyncAction is also an input type for some advanced-scenario utility APIs such as [CoreDispatcher.RunAsync](../windows.ui.core/coredispatcher_runasync_447339746.md) and [ThreadPool.RunAsync](../windows.system.threading/threadpool_runasync_514988780.md).
24+
It's not common to use `IAsyncAction` directly even if you don't use a language-specific awaitable syntax. Each of the languages has extension points that are generally easier to use than the WinRT interface. JavaScript has [WinJS.Promise](/previous-versions/windows/apps/br211867(v=win.10)), and the `then`/`done` syntax. .NET has the [AsTask](/dotnet/api/system.windowsruntimesystemextensions.astask?view=dotnet-uwp-10.0&preserve-view=true) extension method, and once the `IAsyncAction` is converted to a [Task](/dotnet/api/system.threading.tasks.task?view=dotnet-uwp-10.0&preserve-view=true), it's easier to cancel, get notification on completion, and so on. For C++/CX, you can wrap the calls using the [Concurrency runtime](/cpp/parallel/concrt/reference/concurrency-namespace) (and use [create_task](/cpp/parallel/concrt/reference/concurrency-namespace-functions?view=vs-2017)). In other words, `IAsyncAction` can be considered runtime-level infrastructure, which each of the languages use as a framework to support awaitable syntax or asynchronous programming models in their own way.
2125

22-
It's not common to use IAsyncAction directly even if you don't use a language-specific awaitable syntax. Each of the languages has extension points that are generally easier to use than the Windows Runtime interface. JavaScript has [WinJS.Promise](/previous-versions/windows/apps/br211867(v=win.10)), and the **then/done** syntax. .NET has the [AsTask](/dotnet/api/system.windowsruntimesystemextensions.astask?view=dotnet-uwp-10.0&preserve-view=true) extension method, and once the IAsyncAction is converted to a [Task](/dotnet/api/system.threading.tasks.task?view=dotnet-uwp-10.0&preserve-view=true), it's easier to cancel, get notification on completion, and so on. For C++/CX, you can wrap the calls using the [Concurrency runtime](/cpp/parallel/concrt/reference/concurrency-namespace) (and use [create_task](/cpp/parallel/concrt/reference/concurrency-namespace-functions?view=vs-2017)). In other words, IAsyncAction can be considered runtime-level infrastructure, which each of the languages use as a framework to support awaitable syntax or asynchronous programming models in their own way.
26+
Instead of using `IAsyncAction`, some WinRT asynchronous methods use custom action types (which might have "Operation" rather than "Action" in their name). For example, [SignOutUserOperation](../windows.security.authentication.onlineid/signoutuseroperation.md) is a WinRT type that implements `IAsyncAction`. The [SignOutUserOperation](../windows.security.authentication.onlineid/signoutuseroperation.md) type is then used as the custom action return type for the [SignOutUserAsync](../windows.security.authentication.onlineid/onlineidauthenticator_signoutuserasync_658229157.md) method.
2327

24-
Instead of using IAsyncAction, some Windows Runtime asynchronous methods use custom action types (which might have "Operation" rather than "Action" in their name). For example, [SignOutUserOperation](../windows.security.authentication.onlineid/signoutuseroperation.md) is a Windows Runtime type that implements IAsyncAction. The [SignOutUserOperation](../windows.security.authentication.onlineid/signoutuseroperation.md) type is then used as the custom action return type for the [SignOutUserAsync](../windows.security.authentication.onlineid/onlineidauthenticator_signoutuserasync_658229157.md) method.
28+
If you have a method that returns a .NET `Task` and need an `IAsyncAction` to pass to a WinRT API, you can use the [AsAsyncAction](/dotnet/api/system.windowsruntimesystemextensions.asasyncaction?view=dotnet-uwp-10.0&preserve-view=true) extension method.
2529

2630
### C++/WinRT extension functions
2731

2832
> [!NOTE]
29-
> Extension functions exist on the C++/WinRT projection types for certain Windows Runtime APIs. For example, **winrt::Windows::Foundation::IAsyncAction** is the C++/WinRT projection type for **IAsyncAction**. The extension functions aren't part of the application binary interface (ABI) surface of the actual Windows Runtime types, so they're not listed as members of the Windows Runtime APIs. But you can call them from within any C++/WinRT project. See [C++/WinRT functions that extend Windows Runtime APIs](/uwp/cpp-ref-for-winrt/winrt#cwinrt-functions-that-extend-windows-runtime-apis).
33+
> Extension functions exist on the C++/WinRT projection types for certain WinRT APIs. For example, `winrt::Windows::Foundation::IAsyncAction` is the C++/WinRT projection type for `IAsyncAction`. The extension functions aren't part of the application binary interface (ABI) surface of the actual WinRT types, so they're not listed as members of the WinRT APIs. But you can call them from within any C++/WinRT project. See [C++/WinRT functions that extend Windows Runtime APIs](/uwp/cpp-ref-for-winrt/winrt#cwinrt-functions-that-extend-windows-runtime-apis).
3034
3135
```cppwinrt
3236
void get() const;
3337
```
3438

35-
Waits synchronously for the action to complete. Throws a corresponding exception if the action is canceled, or enters an error state. You mustn't call it from a single-threaded apartment. For more info, and code examples showing how to call **get**, see [Write a coroutine](/windows/uwp/cpp-and-winrt-apis/concurrency#write-a-coroutine).
39+
Waits synchronously for the action to complete. Throws a corresponding exception if the action is canceled, or enters an error state. You mustn't call it from a single-threaded apartment. For more info, and code examples showing how to call `get`, see [Write a coroutine](/windows/uwp/cpp-and-winrt-apis/concurrency#write-a-coroutine).
3640

3741
```cppwinrt
3842
AsyncStatus wait_for(TimeSpan const& timeout) const;
3943
```
4044

41-
Waits synchronously for the action to complete, or for the specified timeout. Returns the state of the **IAsyncAction**, or [AsyncStatus::Started](/uwp/api/windows.foundation.asyncstatus) if the timeout elapsed. If the action didn't time out, then call [GetResults](/uwp/api/windows.foundation.iasyncaction.getresults) to obtain the results of the action. For more info, and code examples showing how to call **wait_for**, see [Asynchronous timeouts made easy](/windows/uwp/cpp-and-winrt-apis/concurrency-2#asynchronous-timeouts-made-easy).
45+
Waits synchronously for the action to complete, or for the specified timeout. Returns the state of the `IAsyncAction`, or [AsyncStatus::Started](/uwp/api/windows.foundation.asyncstatus) if the timeout elapsed. If the action didn't time out, then call [GetResults](/uwp/api/windows.foundation.iasyncaction.getresults) to obtain the results of the action. For more info, and code examples showing how to call `wait_for`, see [Asynchronous timeouts made easy](/windows/uwp/cpp-and-winrt-apis/concurrency-2#asynchronous-timeouts-made-easy).
4246

4347
### Interface inheritance
4448

45-
IAsyncAction inherits [IAsyncInfo](iasyncinfo.md). Types that implement IAsyncAction also implement the interface members of [IAsyncInfo](iasyncinfo.md):
49+
`IAsyncAction` inherits [IAsyncInfo](iasyncinfo.md). Types that implement `IAsyncAction` also implement the interface members of [IAsyncInfo](iasyncinfo.md):
50+
4651
+ [Cancel](iasyncinfo_cancel_1985564044.md) method
4752
+ [Close](iasyncinfo_close_811482585.md) method
4853
+ [ErrorCode](iasyncinfo_errorcode.md) property
@@ -51,9 +56,10 @@ IAsyncAction inherits [IAsyncInfo](iasyncinfo.md). Types that implement IAsyncAc
5156

5257
### Notes to implementers
5358

54-
As with calling the existing methods, there are language-specific ways to define asynchronous methods that don't use [IAsyncInfo](iasyncinfo.md) directly. If writing code using .NET, your method can return a [Task](/dotnet/api/system.threading.tasks.task?view=dotnet-uwp-10.0&preserve-view=true). For C++/CX, you can use the [Concurrency runtime](/cpp/parallel/concrt/reference/concurrency-namespace). However, if you're defining a [ component](/previous-versions/windows/apps/hh441572(v=vs.140)), you can use **Task**/**task** internally but you must return one of the Windows Runtime interfaces for your public methods. The language-specific asynchronous support types (and many other language-specific types you might conventionally use in code) can't be used for the public surface area of a Windows Runtime component.
59+
As with calling the existing methods, there are language-specific ways to define asynchronous methods that don't use [IAsyncInfo](iasyncinfo.md) directly. If writing code using .NET, your method can return a [Task](/dotnet/api/system.threading.tasks.task?view=dotnet-uwp-10.0&preserve-view=true). For C++/CX, you can use the [Concurrency runtime](/cpp/parallel/concrt/reference/concurrency-namespace). However, if you're defining a [component](/previous-versions/windows/apps/hh441572(v=vs.140)), you can use `Task`/`task` internally but you must return one of the WinRT interfaces for your public methods. The language-specific asynchronous support types (and many other language-specific types you might conventionally use in code) can't be used for the public surface area of a WinRT component.
5560

5661
## -examples
5762

5863
## -see-also
64+
5965
[IAsyncInfo](iasyncinfo.md), [IAsyncActionWithProgress&lt;TProgress&gt;](iasyncactionwithprogress_1.md), [Asynchronous programming](/windows/uwp/threading-async/asynchronous-programming-universal-windows-platform-apps)

0 commit comments

Comments
 (0)