Skip to content

Commit 35b7760

Browse files
committed
AsValueTask
1 parent 66f2b39 commit 35b7760

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

ManagedCode.Communication/Extensions/ResultExtensions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,28 @@ public static Task<Result> AsTask(this Result result)
2424
{
2525
return Task.FromResult(result);
2626
}
27+
28+
#if NET6_0_OR_GREATER
29+
30+
public static ValueTask<BaseResult<T, TErrorCode>> AsValueTask<T, TErrorCode>(this BaseResult<T, TErrorCode> result) where TErrorCode : Enum
31+
{
32+
return ValueTask.FromResult(result);
33+
}
34+
35+
public static ValueTask<BaseResult<TErrorCode>> AsValueTask<TErrorCode>(this BaseResult<TErrorCode> result) where TErrorCode : Enum
36+
{
37+
return ValueTask.FromResult(result);
38+
}
39+
40+
public static ValueTask<Result<T>> AsValueTask<T>(this Result<T> result)
41+
{
42+
return ValueTask.FromResult(result);
43+
}
44+
45+
public static ValueTask<Result> AsValueTask(this Result result)
46+
{
47+
return ValueTask.FromResult(result);
48+
}
49+
50+
#endif
2751
}

ManagedCode.Communication/ManagedCode.Communication.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net7.0;net6.0;netstandard2.0</TargetFrameworks>
55
<Nullable>enable</Nullable>
66
<LangVersion>10</LangVersion>
77
<IsPackable>true</IsPackable>

0 commit comments

Comments
 (0)