Skip to content

Commit

Permalink
v9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Abraham committed Nov 26, 2024
1 parent 94a0ce4 commit 223c198
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/TypeCache.GraphQL/TypeCache.GraphQL.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>TypeCache.GraphQL</RootNamespace>
<PackageId>TypeCache.GraphQL</PackageId>
<Version>8.4.1</Version>
<Version>9.0.0</Version>
<Authors>Samuel Abraham &lt;sam987883@gmail.com&gt;</Authors>
<Company>Samuel Abraham &lt;sam987883@gmail.com&gt;</Company>
<Title>TypeCache GraphQL</Title>
Expand Down
4 changes: 2 additions & 2 deletions src/TypeCache.Web/TypeCache.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>TypeCache.Web</RootNamespace>
<PackageId>TypeCache.Web</PackageId>
<Version>8.4.1</Version>
<Version>9.0.0</Version>
<Authors>Samuel Abraham &lt;sam987883@gmail.com&gt;</Authors>
<Company>Samuel Abraham &lt;sam987883@gmail.com&gt;</Company>
<Title>TypeCache Web Library</Title>
Expand Down
12 changes: 6 additions & 6 deletions src/TypeCache/Extensions/NumericExtensions.Double.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,46 @@ public static partial class NumericExtensions
/// <c>=&gt; <see cref="TimeSpan"/>.FromDays(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToDays(this double @this)
public static TimeSpan Days(this double @this)
=> TimeSpan.FromDays(@this);

/// <inheritdoc cref="TimeSpan.FromHours(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromHours(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToHours(this double @this)
public static TimeSpan Hours(this double @this)
=> TimeSpan.FromHours(@this);

/// <inheritdoc cref="TimeSpan.FromMicroseconds(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromMicroseconds(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToMicroseconds(this double @this)
public static TimeSpan Microseconds(this double @this)
=> TimeSpan.FromMicroseconds(@this);

/// <inheritdoc cref="TimeSpan.FromMilliseconds(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromMilliseconds(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToMilliseconds(this double @this)
public static TimeSpan Milliseconds(this double @this)
=> TimeSpan.FromMilliseconds(@this);

/// <inheritdoc cref="TimeSpan.FromMinutes(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromMinutes(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToMinutes(this double @this)
public static TimeSpan Minutes(this double @this)
=> TimeSpan.FromMinutes(@this);

/// <inheritdoc cref="TimeSpan.FromSeconds(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromSeconds(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToSeconds(this double @this)
public static TimeSpan Seconds(this double @this)
=> TimeSpan.FromSeconds(@this);
}
15 changes: 7 additions & 8 deletions src/TypeCache/Extensions/NumericExtensions.Int32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,52 @@ public static ulong Factorial(this int @this)

return result;
}
#if NET9_0_OR_GREATER

/// <inheritdoc cref="TimeSpan.FromDays(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromDays(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToDays(this int @this)
public static TimeSpan Days(this int @this)
=> TimeSpan.FromDays(@this);

/// <inheritdoc cref="TimeSpan.FromHours(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromHours(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToHours(this int @this)
public static TimeSpan Hours(this int @this)
=> TimeSpan.FromHours(@this);

/// <inheritdoc cref="TimeSpan.FromMicroseconds(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromMicroseconds(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToMicroseconds(this int @this)
public static TimeSpan Microseconds(this int @this)
=> TimeSpan.FromMicroseconds(@this);

/// <inheritdoc cref="TimeSpan.FromMilliseconds(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromMilliseconds(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToMilliseconds(this int @this)
public static TimeSpan Milliseconds(this int @this)
=> TimeSpan.FromMilliseconds(@this);

/// <inheritdoc cref="TimeSpan.FromMinutes(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromMinutes(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToMinutes(this int @this)
public static TimeSpan Minutes(this int @this)
=> TimeSpan.FromMinutes(@this);

/// <inheritdoc cref="TimeSpan.FromSeconds(double)"/>
/// <remarks>
/// <c>=&gt; <see cref="TimeSpan"/>.FromSeconds(@<paramref name="this"/>);</c>
/// </remarks>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static TimeSpan ToSeconds(this int @this)
public static TimeSpan Seconds(this int @this)
=> TimeSpan.FromSeconds(@this);
#endif
}
10 changes: 5 additions & 5 deletions src/TypeCache/TypeCache.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>TypeCache</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>TypeCache</PackageId>
<Version>8.4.1</Version>
<Version>9.0.0</Version>
<Authors>Samuel Abraham &lt;sam987883@gmail.com&gt;</Authors>
<Company>Samuel Abraham &lt;sam987883@gmail.com&gt;</Company>
<Title>TypeCache Reflection</Title>
Expand Down Expand Up @@ -36,9 +36,9 @@ TypeCache.Reflection - High performance System.Reflection alternative.
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 10 additions & 8 deletions src/TypeCache/Utilities/Sequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,35 @@ public static class Sequence
/// For example: (<c>e^1, e^2, e^3, ...</c>)<br/>
/// Use Linq's Skip method to change the start of the sequence.<br/>
/// Use Linq's Select method to cap values at a maximum or minimum.
/// <param name="count">The power to use in generating the sequence. (<c>i^<paramref name="exponent"/></c>).</param>
/// </summary>
/// <returns>An <c><see cref="Int32.MaxValue"/></c> sequence of <c><see cref="TimeSpan"/></c> values.</returns>
/// <param name="count">The power to use in generating the sequence. (<c>i^<paramref name="exponent"/></c>).</param>
/// <returns>A sequence of <c><paramref name="count"/></c> <c><see cref="TimeSpan"/></c> values.</returns>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static IEnumerable<TimeSpan> ExponentialSeconds(int count)
=> Enumerable.Range(1, count).Select(i => Math.Exp(i).ToSeconds());
=> Enumerable.Range(1, count).Select(i => Math.Exp(i).Seconds());

/// <summary>
/// Creates an infinite sequence of exponentially increasing seconds based on powers of <c><paramref name="exponent"/></c>.<br/>
/// For example when <c><paramref name="exponent"/></c> = 2: (<c>1^2, 2^2, 3^2, ...</c>)<br/>
/// Use Linq's Skip method to change the start of the sequence.<br/>
/// Use Linq's Select method to cap values at a maximum or minimum.
/// </summary>
/// <param name="exponent">The power to use in generating the sequence. (<c>i^<paramref name="exponent"/></c>).</param>
/// <returns>An <c><see cref="Int32.MaxValue"/></c> sequence of <c><see cref="TimeSpan"/></c> values.</returns>
/// <param name="exponent">The power to use in generating the sequence (<c>i^<paramref name="exponent"/></c>).</param>
/// <param name="count"># of values in the sequence.</param>
/// <returns>A sequence of <c><paramref name="count"/></c> <c><see cref="TimeSpan"/></c> values.</returns>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static IEnumerable<TimeSpan> ExponentialSeconds(uint exponent, int count)
=> Enumerable.Range(1, count).Select(i => Math.Pow(i, exponent).ToSeconds());
=> Enumerable.Range(1, count).Select(i => Math.Pow(i, exponent).Seconds());

/// <summary>
/// Creates an infinite sequence of linear increasing times based on a fixed value of <c><paramref name="increase"/></c>.<br/>
/// For example when <c><paramref name="increase"/></c> = 6: <c>(6, 12, 18, ...)</c><br/>
/// Use Linq's Skip method to change the start of the sequence.<br/>
/// Use Linq's Select method to cap values at a maximum or minimum.
/// </summary>
/// <param name="exponent">The power to use in generating the sequence. (<c>i^<paramref name="exponent"/></c>).</param>
/// <returns>An <c><see cref="Int32.MaxValue"/></c> sequence of <c><see cref="TimeSpan"/></c> values.</returns>
/// <param name="increase">The fixed amount of time that the sequence increases by.</param>
/// <param name="count"># of values in the sequence.</param>
/// <returns>A sequence of <c><paramref name="count"/></c> <c><see cref="TimeSpan"/></c> values.</returns>
[MethodImpl(AggressiveInlining), DebuggerHidden]
public static IEnumerable<TimeSpan> LinearTime(TimeSpan increase, int count)
=> Enumerable.Range(1, count).Select(i => i * increase);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/TypeCache.Tests/Extensions/ActionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public async Task Retry()

var timeProvider = new FakeTimeProvider();

var task = action.Retry(Sequence.LinearTime(1.0.ToSeconds(), 10), timeProvider);
var task = action.Retry(Sequence.LinearTime(1.Seconds(), 10), timeProvider);
while (!task.IsCompleted)
timeProvider.Advance(1.0.ToSeconds());
timeProvider.Advance(1.Seconds());

await task;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TypeCache.Tests/Extensions/FuncExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public async Task Retry()

var timeProvider = new FakeTimeProvider();

var task = func.Retry(Sequence.LinearTime(1.0.ToSeconds(), 10), timeProvider);
var task = func.Retry(Sequence.LinearTime(1.Seconds(), 10), timeProvider);
while (!task.IsCompleted)
timeProvider.Advance(1.0.ToSeconds());
timeProvider.Advance(1.Seconds());

var actualValue = await task;
Assert.Equal(expectedValue, actualValue);
Expand Down
6 changes: 3 additions & 3 deletions tests/TypeCache.Tests/TypeCache.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>

<IsPackable>false</IsPackable>

<IsPublishable>False</IsPublishable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 223c198

Please sign in to comment.