Skip to content

Commit 755bcc4

Browse files
authored
Add utility method for allowing .NET Standard 2.0 libraries using the SDK to know whether they are using the .NET Framework version of the SDK. (#3934)
1 parent a99b98f commit 755bcc4

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"core": {
3+
"updateMinimum": false,
4+
"type": "patch",
5+
"changeLogMessages": [
6+
"Add utility method for allowing .NET Standard 2.0 libraries using the SDK to know whether they are using the .NET Framework version of the SDK."
7+
]
8+
}
9+
}

sdk/src/Core/Amazon.Util/AWSSDKUtils.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,21 @@ private static bool IsWindows()
946946
#endif
947947
}
948948

949+
/// <summary>
950+
/// This method returns true if the variant of the SDK being used is the .NET Framework target. This allows
951+
/// libraries using .NET Standard 2.0 like AWSSDK.Extensions.NETCore.Setup to know at runtime if they are
952+
/// using the .NET Framework version and if so make decisions on what APIs it should call.
953+
/// </summary>
954+
/// <returns>True if the version of the SDK is .NET Framework variant.</returns>
955+
public static bool IsNETFramework()
956+
{
957+
#if NETFRAMEWORK
958+
return true;
959+
#else
960+
return false;
961+
#endif
962+
}
963+
949964
#region The code in this region has been minimally adapted from Microsoft's PathInternal.Windows.cs class as of 11/19/2019. The logic remains the same.
950965
/// <summary>
951966
/// Returns true if the path specified is relative to the current drive or working directory.
@@ -1018,7 +1033,7 @@ public static string UrlEncode(string data, bool path)
10181033
/// URL encodes a string per the specified RFC. If the path property is specified,
10191034
/// the accepted path characters {/+:} are not encoded.
10201035
/// </summary>
1021-
/// <param name="rfcNumber">RFC number determing safe characters</param>
1036+
/// <param name="rfcNumber">RFC number determining safe characters</param>
10221037
/// <param name="data">The string to encode</param>
10231038
/// <param name="path">Whether the string is a URL path or not</param>
10241039
/// <returns>The encoded string</returns>

0 commit comments

Comments
 (0)