Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Aug 16, 2024
1 parent a7c118d commit 7f99487
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 38 deletions.
3 changes: 1 addition & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ using System.Threading.Tasks;

static partial class Polyfill
{

#if FeatureValueTask

/// <summary>
Expand Down Expand Up @@ -307,7 +306,7 @@ static partial class Polyfill
}
#endif
```
<sup><a href='/src/Polyfill/Polyfill_TextWriter.cs#L1-L120' title='Snippet source file'>snippet source</a> | <a href='#snippet-Polyfill_TextWriter.cs' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Polyfill/Polyfill_TextWriter.cs#L1-L119' title='Snippet source file'>snippet source</a> | <a href='#snippet-Polyfill_TextWriter.cs' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
4 changes: 1 addition & 3 deletions src/Polyfill/IsExternalInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace System.Runtime.CompilerServices;
#if PolyPublic
public
#endif
static class IsExternalInit
{
}
static class IsExternalInit;

#endif
4 changes: 1 addition & 3 deletions src/Polyfill/Polyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ namespace Polyfills;
#if PolyPublic
public
#endif
static partial class Polyfill
{
}
static partial class Polyfill;
1 change: 0 additions & 1 deletion src/Polyfill/Polyfill_TextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace Polyfills;

static partial class Polyfill
{

#if FeatureValueTask

/// <summary>
Expand Down
10 changes: 4 additions & 6 deletions src/Polyfill/Polyfill_Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ public static bool HasSameMetadataDefinitionAs(this MemberInfo target, MemberInf
/// Gets a value that indicates whether the current Type represents a type parameter in the definition of a generic method.
/// </summary>
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.type.isgenericmethodparameter")]
public static bool IsGenericMethodParameter(this Type target)
{
public static bool IsGenericMethodParameter(this Type target) =>
#if NETFRAMEWORK || NETSTANDARD2_0 || NETCOREAPP2_0
return target.IsGenericParameter &&
target.DeclaringMethod != null;
target.IsGenericParameter &&
target.DeclaringMethod != null;
#else
return target.IsGenericMethodParameter;
target.IsGenericMethodParameter;
#endif
}

/// <summary>
/// Generic version of Type.IsAssignableTo https://learn.microsoft.com/en-us/dotnet/api/system.type.isassignableto.
Expand Down
4 changes: 1 addition & 3 deletions src/Polyfill/ResolveHttpGlobalProblem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ namespace System.Net.Http;
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
static class ResolveHttpGlobalProblem
{
}
static class ResolveHttpGlobalProblem;

#endif
32 changes: 12 additions & 20 deletions src/Polyfill/StringPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,43 @@ static partial class StringPolyfill
/// Concatenates an array of strings, using the specified separator between each member.
/// </summary>
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string())")]
public static string Join(char separator, string[] values)
{
public static string Join(char separator, string[] values) =>
#if NETSTANDARD2_0 || NETFRAMEWORK
return string.Join(new([separator]), values);
string.Join(new([separator]), values);
#else
return string.Join(separator, values);
string.Join(separator, values);
#endif
}

/// <summary>
/// Concatenates the string representations of an array of objects, using the specified separator between each member.
/// </summary>
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object())")]
public static string Join(char separator, object[] values)
{
public static string Join(char separator, object[] values) =>
#if NETSTANDARD2_0 || NETFRAMEWORK
return string.Join(new([separator]), values);
string.Join(new([separator]), values);
#else
return string.Join(separator, values);
string.Join(separator, values);
#endif
}

/// <summary>
/// Concatenates the specified elements of a string array, using the specified separator between each element.
/// </summary>
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()-system-int32-system-int32)")]
public static string Join(char separator, string?[] value, int startIndex, int count)
{
public static string Join(char separator, string?[] value, int startIndex, int count) =>
#if NETSTANDARD2_0 || NETFRAMEWORK
return string.Join(new([separator]), value, startIndex, count);
string.Join(new([separator]), value, startIndex, count);
#else
return string.Join(separator, value, startIndex, count);
string.Join(separator, value, startIndex, count);
#endif
}

/// <summary>
/// Concatenates the specified elements of a string array, using the specified separator between each element.
/// </summary>
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join-1(system-char-system-collections-generic-ienumerable((-0)))")]
public static string Join<T>(char separator, IEnumerable<T> values)
{
public static string Join<T>(char separator, IEnumerable<T> values) =>
#if NETSTANDARD2_0 || NETFRAMEWORK
return string.Join(new([separator]), values);
string.Join(new([separator]), values);
#else
return string.Join(separator, values);
string.Join(separator, values);
#endif
}
}

0 comments on commit 7f99487

Please sign in to comment.