Skip to content

Commit

Permalink
Update the return type of Cast<T>() from IResult<T> to Result<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedkamalio committed Oct 14, 2024
1 parent 5c0558d commit 6ecdac3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
- Improved error handling validation in tests.
- Removed exceptions where not necessary (like accessing `Value` on failure).
- Updated tests to reflect the new `Cast<T>()` behavior.

## v1.0.4

1. `Cast<T>()`:
- Update the return type of `Cast<T>()` from `IResult<T>` to `Result<T>`.
2 changes: 1 addition & 1 deletion src/ResultObject/IResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ public interface IResult<out TValue>
/// A new <see cref="Result{T}"/> with the value cast to the specified type, or the same error if the result was a failure.
/// </returns>
/// <exception cref="InvalidCastException">Thrown if the value cannot be cast to the specified type.</exception>
IResult<T> Cast<T>();
Result<T> Cast<T>();
}
2 changes: 1 addition & 1 deletion src/ResultObject/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Result<TValue>(TValue? value, ResultError? error) : IResult<TValue>
/// A new <see cref="Result{T}"/> with the value cast to the specified type, or the same error if the result was a failure.
/// </returns>
/// <exception cref="InvalidCastException">Thrown if the value cannot be cast to the specified type.</exception>
public IResult<T> Cast<T>()
public Result<T> Cast<T>()
{
if (IsFailure)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ResultObject/ResultObject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<!-- NuGet Package Metadata -->
<PackageId>ResultObject</PackageId>
<Version>1.0.3</Version>
<Version>1.0.4</Version>
<Authors>Ahmed Kamal</Authors>
<Description>A simple result object for DotNet.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down

0 comments on commit 6ecdac3

Please sign in to comment.