Skip to content

Commit 801a5cf

Browse files
committed
Added an example of a function returning a task.
1 parent 76decf0 commit 801a5cf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

docs/guides-basic/dotnet-native-aot-support.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal class Functions
5353
| A1 | =NativeHello("AOT") | Hello AOT!
5454
| A2 | =NativeSum(2, 3) | 5
5555

56-
## Async function
56+
## Async functions and tasks
5757

5858
```csharp
5959
[ExcelAsyncFunction]
@@ -69,12 +69,19 @@ public static string NativeAsyncHello(string name, int msToSleep)
6969
Thread.Sleep(msToSleep);
7070
return $"Hello native async {name}";
7171
}
72+
73+
[ExcelFunction]
74+
public static Task<string> NativeTaskHello(string name)
75+
{
76+
return Task.FromResult($"Hello native task {name}");
77+
}
7278
```
7379

74-
| Cell | Formula | Immediate Result | Final Result
75-
| ----- | ----------------------------------- | ---------------- | -------------------------
76-
| A1 | =NativeAsyncTaskHello("Test", 5000) | #N/A | Hello native async task Test
77-
| B1 | =NativeAsyncHello("Test", 5000) | #N/A | Hello native async Test
80+
| Cell | Formula | Immediate Result | Final Result
81+
| ----- | ----------------------------------- | ---------------------- | -------------------------
82+
| A1 | =NativeAsyncTaskHello("Test", 5000) | #N/A | Hello native async task Test
83+
| B1 | =NativeAsyncHello("Test", 5000) | #N/A | Hello native async Test
84+
| C1 | =NativeTaskHello("Test") | Hello native task Test | Hello native task Test
7885

7986
## AddIn
8087

0 commit comments

Comments
 (0)