Skip to content

Commit

Permalink
update 1.0.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
nameofSEOKWONHONG committed Jun 8, 2024
1 parent 340217b commit 46d7b73
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ Refer to the test code for how to use it.
net7, net8

## Version
* 1.0.1.0
* 1.0.1.11
* change - xIsEmpty dose not support Number type.
* remove - xIsNumber<T>(this T obj), remain xIsNumber(this string str)
* error modify - xBatch error modify.

* 1.0.0.10
* error modify - xcrypthmac -> fromHexToByte, fromHexToString xforeach loop error
Expand Down
3 changes: 2 additions & 1 deletion src/XForEachExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public static IEnumerable<T[]> xBatch<T>(this IEnumerable<T> valaus, int batchSi
var array = valaus.ToArray();
for (int i = 0; i < array.Length; i += batchSize)
{
var batch = array[i..(i+batchSize)];
int size = Math.Min(batchSize, array.Length - i);
var batch = array[i..(i + size)];
yield return batch;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/eXtensionSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Copyright>MIT</Copyright>
<Product>eXtensionSharp</Product>
<Company>seokwon hong</Company>
<Version>1.0.0.10</Version>
<Version>1.0.0.11</Version>
<FileVersion>1.0.0.8</FileVersion>
<Title>eXtensionSharp</Title>
<Description>c# extensions</Description>
Expand Down
13 changes: 13 additions & 0 deletions test/xForEachTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,18 @@ public async Task async_no_wait_test()
Assert.That(item,Is.Not.Zero);
});
}

[Test]
public void xbatch_test()
{
var items = Enumerable.Range(1, 1000).ToList();
var batchItems = items.xBatch(412);
foreach (var batchItem in batchItems)
{
Assert.That(items, Does.Contain(batchItem.First()));
}

Assert.Pass();
}
}
}

0 comments on commit 46d7b73

Please sign in to comment.