File tree Expand file tree Collapse file tree 6 files changed +45
-4
lines changed Expand file tree Collapse file tree 6 files changed +45
-4
lines changed Original file line number Diff line number Diff line change 77using System . Net ;
88using System . Net . Http ;
99using System . Net . Http . Headers ;
10- using System . Reflection ;
1110using System . Text ;
1211using System . Threading ;
1312using System . Threading . Tasks ;
13+ #if NET40
14+ using SendGrid . Helpers . Net40 ;
15+ #else
16+ using System . Reflection ;
17+ #endif
1418
1519namespace SendGrid
1620{
Original file line number Diff line number Diff line change 77using System ;
88using System . Collections . Generic ;
99using System . Linq ;
10+ #if NET40
11+ using SendGrid . Helpers . Net40 ;
12+ #else
1013using System . Reflection ;
14+ #endif
1115
1216namespace SendGrid . Helpers . Mail
1317{
Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace SendGrid . Helpers . Net40
4+ {
5+ internal static class TypeExtensions
6+ {
7+ public static Type GetTypeInfo ( this Type type ) => type ;
8+ }
9+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Threading ;
3+ using System . Threading . Tasks ;
4+
5+ namespace SendGrid . Helpers
6+ {
7+ internal static class TaskUtilities
8+ {
9+ public static Task Delay ( TimeSpan delay , CancellationToken cancellationToken = default )
10+ {
11+ #if NET40
12+ return TaskEx . Delay ( delay , cancellationToken ) ;
13+ #else
14+ return Task . Delay ( delay , cancellationToken ) ;
15+ #endif
16+ }
17+ }
18+ }
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
8383 }
8484
8585 // ReSharper disable once MethodSupportsCancellation, cancel will be indicated on the token
86- await Task . Delay ( waitFor ) . ConfigureAwait ( false ) ;
86+ await TaskUtilities . Delay ( waitFor ) . ConfigureAwait ( false ) ;
8787 }
8888 catch ( HttpRequestException )
8989 {
@@ -94,7 +94,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
9494 throw ;
9595 }
9696
97- await Task . Delay ( waitFor ) . ConfigureAwait ( false ) ;
97+ await TaskUtilities . Delay ( waitFor ) . ConfigureAwait ( false ) ;
9898 }
9999 }
100100
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <VersionPrefix >9.16.0</VersionPrefix >
5- <TargetFrameworks >netstandard1.3;netstandard2.0;net452</TargetFrameworks >
5+ <TargetFrameworks >netstandard1.3;netstandard2.0;net452;net40 </TargetFrameworks >
66 <PlatformTarget >anycpu</PlatformTarget >
77 <GenerateDocumentationFile >true</GenerateDocumentationFile >
88 <OutputType >Library</OutputType >
5959 <Reference Include =" Microsoft.CSharp" />
6060 </ItemGroup >
6161
62+ <ItemGroup Condition =" '$(TargetFramework)' == 'net40' " >
63+ <PackageReference Include =" Newtonsoft.Json" Version =" 9.0.1" />
64+ <PackageReference Include =" Microsoft.Bcl.Async" Version =" 1.0.168" />
65+ <PackageReference Include =" Microsoft.Net.Http" Version =" 2.2.29" />
66+ </ItemGroup >
67+
6268</Project >
You can’t perform that action at this time.
0 commit comments