Skip to content

Commit

Permalink
CollectionResult<T> Empty()
Browse files Browse the repository at this point in the history
  • Loading branch information
KSemenenko committed Jun 27, 2024
1 parent f1421a4 commit 642d8d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<RepositoryUrl>https://github.com/managedcode/Communication</RepositoryUrl>
<PackageProjectUrl>https://github.com/managedcode/Communication</PackageProjectUrl>
<Product>Managed Code - Communication</Product>
<Version>8.0.4</Version>
<PackageVersion>8.0.4</PackageVersion>
<Version>8.0.5</Version>
<PackageVersion>8.0.5</PackageVersion>

</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ public partial struct CollectionResult<T>
{
public static CollectionResult<T> Succeed(T[] value, int pageNumber, int pageSize, int totalItems)
{
return new CollectionResult<T>(true, value, pageNumber, pageSize, totalItems, null, default);
return new CollectionResult<T>(true, value, pageNumber, pageSize, totalItems, default, default);
}

public static CollectionResult<T> Succeed(IEnumerable<T> value, int pageNumber, int pageSize, int totalItems)
{
return new CollectionResult<T>(true, value, pageNumber, pageSize, totalItems, null, default);
return new CollectionResult<T>(true, value, pageNumber, pageSize, totalItems, default, default);
}

public static CollectionResult<T> Succeed(T[] value)
{
return new CollectionResult<T>(true, value, 1, value.Length, value.Length, null, default);
return new CollectionResult<T>(true, value, 1, value.Length, value.Length, default, default);
}

public static CollectionResult<T> Succeed(IEnumerable<T> value)
{
var array = value.ToArray();
return new CollectionResult<T>(true, array, 1, array.Length, array.Length, null, default);
return new CollectionResult<T>(true, array, 1, array.Length, array.Length, default, default);
}

public static CollectionResult<T> Empty()
{
return new CollectionResult<T>(true, [], 0, 0, 0, default, default);
}
}

0 comments on commit 642d8d0

Please sign in to comment.