diff --git a/README.md b/README.md index 8e3cbe71..107e3155 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ private static IEnumerable GenData(byte quantity) { for (var i = 0; i < quantity; i++) { - yield return i % 2 == 0 + yield return i % 2 is 0 ? new JsonTestDto { Id = NewGuid(), diff --git a/lib/YANLib/Async/YANFunc.cs b/lib/YANLib/Async/YANFunc.cs index 03d8934e..6e78f460 100644 --- a/lib/YANLib/Async/YANFunc.cs +++ b/lib/YANLib/Async/YANFunc.cs @@ -11,30 +11,11 @@ public static async ValueTask> AggregateResultsConcurrentlyAsync { + var rng = await func(arg).ToListAsync(); await semSlim.WaitAsync(); try { - rslts.AddRange(await func(arg).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IEnumerable args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); + rslts.AddRange(rng); } finally { @@ -51,270 +32,11 @@ public static async ValueTask> AggregateResultsConcurrentlyAsync { + var rng = await func(arg, coll).ToListAsync(); await semSlim.WaitAsync(); try { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IEnumerable args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IEnumerable args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IEnumerable args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func> func, IReadOnlyCollection args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyCollection args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyCollection args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyCollection args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyCollection args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyCollection args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func> func, IReadOnlyList args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyList args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyList args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyList args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); + rslts.AddRange(rng); } finally { @@ -325,16 +47,17 @@ public static async ValueTask> AggregateResultsConcurrentlyAsync> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyList args, IReadOnlyList coll) + public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IEnumerable args) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var rng = await (await func(arg)).ToListAsync(); await semSlim.WaitAsync(); try { - rslts.AddRange(await func(arg, coll).ToListAsync()); + rslts.AddRange(rng); } finally { @@ -345,16 +68,17 @@ public static async ValueTask> AggregateResultsConcurrentlyAsync> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlyList args, IReadOnlySet coll) + public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IEnumerable args, IEnumerable coll) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var rng = await (await func(arg, coll)).ToListAsync(); await semSlim.WaitAsync(); try { - rslts.AddRange(await func(arg, coll).ToListAsync()); + rslts.AddRange(rng); } finally { @@ -365,16 +89,17 @@ public static async ValueTask> AggregateResultsConcurrentlyAsync> AggregateResultsConcurrentlyAsync(Func> func, IReadOnlySet args) + public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IEnumerable args) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var rng = await (await func(arg)).ToListAsync(); await semSlim.WaitAsync(); try { - rslts.AddRange(await func(arg).ToListAsync()); + rslts.AddRange(rng); } finally { @@ -385,1056 +110,17 @@ public static async ValueTask> AggregateResultsConcurrentlyAsync> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlySet args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlySet args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlySet args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlySet args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, IAsyncEnumerable> func, IReadOnlySet args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await func(arg, coll).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IEnumerable args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IEnumerable args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IEnumerable args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IEnumerable args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IEnumerable args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IEnumerable args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IReadOnlyCollection args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyCollection args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyCollection args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyCollection args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyCollection args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyCollection args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IReadOnlyList args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyList args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyList args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyList args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyList args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlyList args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IReadOnlySet args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlySet args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlySet args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlySet args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlySet args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, ValueTask>> func, IReadOnlySet args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IEnumerable args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IEnumerable args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IEnumerable args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IEnumerable args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IEnumerable args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IEnumerable args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IReadOnlyCollection args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyCollection args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyCollection args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyCollection args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyCollection args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyCollection args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IReadOnlyList args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyList args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyList args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyList args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyList args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlyList args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func>> func, IReadOnlySet args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlySet args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlySet args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlySet args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlySet args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IReadOnlySet args, IReadOnlySet coll) + public static async ValueTask> AggregateResultsConcurrentlyAsync(Func, Task>> func, IEnumerable args, IEnumerable coll) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var rng = await (await func(arg, coll)).ToListAsync(); await semSlim.WaitAsync(); try { - rslts.AddRange(await (await func(arg, coll)).ToListAsync()); + rslts.AddRange(rng); } finally { diff --git a/lib/YANLib/Nullable/YANDateTime.Nullable.cs b/lib/YANLib/Nullable/YANDateTime.Nullable.cs index f9f924fc..ac08ad42 100644 --- a/lib/YANLib/Nullable/YANDateTime.Nullable.cs +++ b/lib/YANLib/Nullable/YANDateTime.Nullable.cs @@ -98,27 +98,6 @@ public static partial class YANDateTime } } - /// - /// Converts an enumerable of strings representing date/time values in a specified format to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// If a string cannot be parsed to a valid DateTime value, the default value specified by is used instead. - /// - /// The format of the date/time values in the input strings. - /// The default DateTime value to be used for strings that cannot be parsed to valid DateTime values. - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs, string fmt, DateTime? dfltVal) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(fmt, dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. @@ -358,24 +337,6 @@ public static partial class YANDateTime } } - /// - /// Gets the week of the year for an enumerable of DateTime values using the default calendar of the current culture. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The enumerable of DateTime values for which to get the week of the year. - /// An containing the week of the year values for the input DateTime values. - public static IEnumerable GetWeekOfYear(this IReadOnlySet dts) - { - if (dts is null || dts.Count > 0) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.GetWeekOfYear(); - } - } - /// /// Returns the total number of months between the two specified values, ignoring the day of the month. /// @@ -503,29 +464,6 @@ public static partial class YANDateTime } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -649,29 +587,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1 tzSrc } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Returns a new value representing the same point in time as the original value, but converted to a different time zone. /// @@ -775,29 +690,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1 tzSrc } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Returns a new value representing the same point in time as the original value, but converted to a different time zone. /// @@ -901,29 +793,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1 tzSrc } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1047,29 +916,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1? tzSr } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1193,29 +1039,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1 tzSrc } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Returns a new value representing the same point in time as the original value, but converted to a different time zone. /// @@ -1319,29 +1142,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1 tzSrc } } - /// - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1447,25 +1247,6 @@ public static void ChangeTimeZoneRef(this IList dts, T1? tzSr } } - /// - /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - /// - /// The type of the time zone offset to convert the original value to, which must be a value type. - /// The original value. - /// The time zone offset to convert the original value to, in hours. - /// A new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Converts a list of DateTime values from one time zone to another using the specified destination time zone, and updates the original list in place with the DateTime values converted to the destination time zone. /// If the input list is or empty, no changes will be made. @@ -1569,25 +1350,6 @@ public static void ChangeTimeZoneRef(this IList dts, T tzDst) wher } } - /// - /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - /// - /// The type of the time zone offset to convert the original value to, which must be a value type. - /// The original value. - /// The time zone offset to convert the original value to, in hours. - /// A new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T? tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. /// @@ -1673,25 +1435,6 @@ public static void ChangeTimeZoneRef(this IList dts, T tzDst) wher } } - /// - /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - /// - /// The type of the time zone offset to convert the original value to, which must be a value type. - /// The original value. - /// The time zone offset to convert the original value to, in hours. - /// A new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T? tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Converts a list of DateTime values from one time zone to another using the specified destination time zone, and updates the original list in place with the DateTime values converted to the destination time zone. /// If the input list is or empty, no changes will be made. diff --git a/lib/YANLib/Nullable/YANDateTime.cs b/lib/YANLib/Nullable/YANDateTime.cs index 67e1cb3f..77e25a64 100644 --- a/lib/YANLib/Nullable/YANDateTime.cs +++ b/lib/YANLib/Nullable/YANDateTime.cs @@ -89,24 +89,6 @@ public static partial class YANDateTime } } - /// - /// Converts an enumerable of strings representing date/time values to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(); - } - } - /// /// Parses the string representation of a date and time using . /// Returns the parsed value, or if the parsing fails. @@ -192,25 +174,6 @@ public static partial class YANDateTime } } - /// - /// Converts an enumerable of strings representing date/time values in a specified format to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// - /// The format of the date/time values in the input strings. - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs, string fmt) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(fmt); - } - } - /// /// Parses the string representation of a date and time using . /// Returns the parsed value, or if the parsing fails. @@ -305,27 +268,6 @@ public static partial class YANDateTime } } - /// - /// Converts an enumerable of strings representing date/time values in a specified format to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// If a string cannot be parsed to a valid DateTime value, the default value specified by is used instead. - /// - /// The format of the date/time values in the input strings. - /// The default DateTime value to be used for strings that cannot be parsed to valid DateTime values. - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs, string fmt, DateTime dfltVal) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(fmt, dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. @@ -448,24 +390,6 @@ public static partial class YANDateTime } } - /// - /// Gets the week of the year for an enumerable of DateTime values using the default calendar of the current culture. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The enumerable of DateTime values for which to get the week of the year. - /// An containing the week of the year values for the input DateTime values. - public static IEnumerable GetWeekOfYear(this IReadOnlySet dts) - { - if (dts is null || dts.Count > 0) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.GetWeekOfYear(); - } - } - /// /// Returns the total number of months between the two specified values, ignoring the day of the month. /// @@ -582,28 +506,6 @@ public static partial class YANDateTime } } - /// - /// Converts an enumerable of DateTime values from one time zone to another using the specified source and destination time zones. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone to convert from. - /// The destination time zone to convert to. - /// The enumerable of DateTime values to convert. - /// An containing the DateTime values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. /// @@ -692,24 +594,4 @@ public static partial class YANDateTime yield return dts[i].ChangeTimeZone(tzDst); } } - - /// - /// Converts an array of DateTime values from one time zone to another using the specified destination time zone, and returns an containing the DateTime values converted to the destination time zone. - /// Returns an empty sequence if the input array is or empty. - /// - /// The type of the destination time zone. - /// The destination time zone to convert to. - /// The array of DateTime values to convert. - /// An containing the DateTime values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } } diff --git a/lib/YANLib/Nullable/YANNum.Byte.Nullable.cs b/lib/YANLib/Nullable/YANNum.Byte.Nullable.cs index fe0fd064..2c00acee 100644 --- a/lib/YANLib/Nullable/YANNum.Byte.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Byte.Nullable.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToByte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToByte(); - } - } - /// /// Parses the string representation of a byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of string objects to an containing the byte representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the byte representations of the strings. - public static IEnumerable ToByte(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToByte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Byte.cs b/lib/YANLib/Nullable/YANNum.Byte.cs index 4a9f26e4..57fcd9a4 100644 --- a/lib/YANLib/Nullable/YANNum.Byte.cs +++ b/lib/YANLib/Nullable/YANNum.Byte.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToByte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToByte(); - } - } - /// /// Parses the string representation of a byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of string objects to an containing the byte representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// The enumerable of string objects to be converted. - /// An containing the byte representations of the strings. - public static IEnumerable ToByte(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToByte(); - } - } - /// /// Parses the string representation of a byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of string objects to an containing the byte representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the byte representations of the strings. - public static IEnumerable ToByte(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToByte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Decimal.Nullable.cs b/lib/YANLib/Nullable/YANNum.Decimal.Nullable.cs index 0fa67029..dba9daef 100644 --- a/lib/YANLib/Nullable/YANNum.Decimal.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Decimal.Nullable.cs @@ -105,27 +105,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of values of a generic value type to an containing the decimal representations of the values. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the values to be converted, which must be a value type. - /// - /// The enumerable of values to be converted. - /// An containing the decimal representations of the values. - public static IEnumerable ToDecimal(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDecimal(); - } - } - /// /// Parses the string representation of a decimal using the default format. /// Returns the parsed value, or if the parsing fails. @@ -228,29 +207,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of string objects to an containing the decimal representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the decimal representations of the strings. - public static IEnumerable ToDecimal(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDecimal(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Decimal.cs b/lib/YANLib/Nullable/YANNum.Decimal.cs index 56d09e6f..1735bafa 100644 --- a/lib/YANLib/Nullable/YANNum.Decimal.cs +++ b/lib/YANLib/Nullable/YANNum.Decimal.cs @@ -105,27 +105,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of values of a generic value type to an containing the decimal representations of the values. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the values to be converted, which must be a value type. - /// - /// The enumerable of values to be converted. - /// An containing the decimal representations of the values. - public static IEnumerable ToDecimal(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDecimal(); - } - } - /// /// Parses the string representation of a decimal using the default format. /// Returns the parsed value, or if the parsing fails. @@ -206,24 +185,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of string objects to an containing the decimal representations of the strings. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The enumerable of string objects to be converted. - /// An containing the decimal representations of the strings. - public static IEnumerable ToDecimal(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDecimal(); - } - } - /// /// Parses the string representation of a decimal using the default format. /// Returns the parsed value, or if the parsing fails. @@ -326,29 +287,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of string objects to an containing the decimal representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the decimal representations of the strings. - public static IEnumerable ToDecimal(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDecimal(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Double.Nullable.cs b/lib/YANLib/Nullable/YANNum.Double.Nullable.cs index adc9cf7a..e0b8d1a7 100644 --- a/lib/YANLib/Nullable/YANNum.Double.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Double.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the double representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the double representations of the objects. - public static IEnumerable ToDouble(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDouble(); - } - } - /// /// Parses the string representation of a double using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the double representations of the strings, using a default value for conversion failures. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failures. - /// Must be a value type. - /// - /// The default value to use for conversion failures. - /// The enumerable of strings to be converted. - /// An containing the double representations of the strings. - public static IEnumerable ToDouble(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDouble(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Double.cs b/lib/YANLib/Nullable/YANNum.Double.cs index af285a95..d10e0c29 100644 --- a/lib/YANLib/Nullable/YANNum.Double.cs +++ b/lib/YANLib/Nullable/YANNum.Double.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the double representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the double representations of the objects. - public static IEnumerable ToDouble(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDouble(); - } - } - /// /// Parses the string representation of a double using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the double representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the double representations of the strings. - public static IEnumerable ToDouble(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDouble(); - } - } - /// /// Parses the string representation of a double using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the double representations of the strings, using a default value for conversion failures. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failures. - /// Must be a value type. - /// - /// The default value to use for conversion failures. - /// The enumerable of strings to be converted. - /// An containing the double representations of the strings. - public static IEnumerable ToDouble(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDouble(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Float.Nullable.cs b/lib/YANLib/Nullable/YANNum.Float.Nullable.cs index 25b2b0ed..bc25eb4f 100644 --- a/lib/YANLib/Nullable/YANNum.Float.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Float.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the float representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the float representations of the objects. - public static IEnumerable ToFloat(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToFloat(); - } - } - /// /// Parses the string representation of a float using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the float representations of the strings, using a default value for parsing invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for parsing invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for parsing invalid or null strings. - /// The enumerable of strings to be converted to float. - /// An containing the float representations of the strings. - public static IEnumerable ToFloat(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToFloat(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Float.cs b/lib/YANLib/Nullable/YANNum.Float.cs index a253125f..5cb55ad5 100644 --- a/lib/YANLib/Nullable/YANNum.Float.cs +++ b/lib/YANLib/Nullable/YANNum.Float.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the float representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the float representations of the objects. - public static IEnumerable ToFloat(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToFloat(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the float representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted to float. - /// An containing the float representations of the strings. - public static IEnumerable ToFloat(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToFloat(); - } - } - /// /// Parses the string representation of a float using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the float representations of the strings, using a default value for parsing invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for parsing invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for parsing invalid or null strings. - /// The enumerable of strings to be converted to float. - /// An containing the float representations of the strings. - public static IEnumerable ToFloat(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToFloat(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Int.Nullable.cs b/lib/YANLib/Nullable/YANNum.Int.Nullable.cs index 128ec2b7..6f504649 100644 --- a/lib/YANLib/Nullable/YANNum.Int.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Int.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the integer representations of the objects. - public static IEnumerable ToInt(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToInt(); - } - } - /// /// Parses the string representation of an integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the integer representations of the strings, using the specified default value for parsing strings that cannot be converted to integers. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for parsing strings that cannot be converted to integers. - /// Must be a value type. - /// - /// The default value to be used for parsing strings that cannot be converted to integers. - /// The enumerable of strings to be converted. - /// An containing the integer representations of the strings. - public static IEnumerable ToInt(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToInt(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Int.cs b/lib/YANLib/Nullable/YANNum.Int.cs index bcc8ff85..e07458b1 100644 --- a/lib/YANLib/Nullable/YANNum.Int.cs +++ b/lib/YANLib/Nullable/YANNum.Int.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the integer representations of the objects. - public static IEnumerable ToInt(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToInt(); - } - } - /// /// Parses the string representation of an integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the integer representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the integer representations of the strings. - public static IEnumerable ToInt(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToInt(); - } - } - /// /// Parses the string representation of an integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the integer representations of the strings, using the specified default value for parsing strings that cannot be converted to integers. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for parsing strings that cannot be converted to integers. - /// Must be a value type. - /// - /// The default value to be used for parsing strings that cannot be converted to integers. - /// The enumerable of strings to be converted. - /// An containing the integer representations of the strings. - public static IEnumerable ToInt(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToInt(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Long.Nullable.cs b/lib/YANLib/Nullable/YANNum.Long.Nullable.cs index 63b29904..86953117 100644 --- a/lib/YANLib/Nullable/YANNum.Long.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Long.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the long integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the long integer representations of the objects. - public static IEnumerable ToLong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToLong(); - } - } - /// /// Parses the string representation of a long using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the long integer representations of the strings, using a default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the long integer representations of the strings. - public static IEnumerable ToLong(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToLong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Long.cs b/lib/YANLib/Nullable/YANNum.Long.cs index 19678373..f6798985 100644 --- a/lib/YANLib/Nullable/YANNum.Long.cs +++ b/lib/YANLib/Nullable/YANNum.Long.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the long integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the long integer representations of the objects. - public static IEnumerable ToLong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToLong(); - } - } - /// /// Parses the string representation of a long using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the long integer representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the long integer representations of the strings. - public static IEnumerable ToLong(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToLong(); - } - } - /// /// Parses the string representation of a long using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the long integer representations of the strings, using a default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the long integer representations of the strings. - public static IEnumerable ToLong(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToLong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Nint.Nullable.cs b/lib/YANLib/Nullable/YANNum.Nint.Nullable.cs index 8ff33311..8f0eead5 100644 --- a/lib/YANLib/Nullable/YANNum.Nint.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Nint.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the nint representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the nint representations of the objects. - public static IEnumerable ToNint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNint(); - } - } - /// /// Parses the string representation of a pointer-sized signed integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -245,32 +223,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the nint representations of the strings, with an optional default value for conversion. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion. - /// Must be a value type. - /// - /// - /// The default value for conversion if a string cannot be parsed to nint. - /// Used when conversion fails for a particular string. - /// - /// The enumerable of strings to be converted. - /// An containing the nint representations of the strings. - public static IEnumerable ToNint(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Nint.cs b/lib/YANLib/Nullable/YANNum.Nint.cs index 4e6f83fe..69b01d4e 100644 --- a/lib/YANLib/Nullable/YANNum.Nint.cs +++ b/lib/YANLib/Nullable/YANNum.Nint.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the nint representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the nint representations of the objects. - public static IEnumerable ToNint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNint(); - } - } - /// /// Parses the string representation of a nint using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the nint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the nint representations of the strings. - public static IEnumerable ToNint(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNint(); - } - } - /// /// Parses the string representation of a nint using the default format. /// Returns the parsed value, or if the parsing fails. @@ -343,32 +303,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the nint representations of the strings, with an optional default value for conversion. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion. - /// Must be a value type. - /// - /// - /// The default value for conversion if a string cannot be parsed to nint. - /// Used when conversion fails for a particular string. - /// - /// The enumerable of strings to be converted. - /// An containing the nint representations of the strings. - public static IEnumerable ToNint(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Nuint.Nullable.cs b/lib/YANLib/Nullable/YANNum.Nuint.Nullable.cs index 3cfe0028..139def7a 100644 --- a/lib/YANLib/Nullable/YANNum.Nuint.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Nuint.Nullable.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an enumerable of values, which represent the unsigned integer equivalent of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the objects. - public static IEnumerable ToNuint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNuint(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an enumerable of values, which represent the unsigned integer equivalent of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for conversion. - /// Must be a value type. - /// - /// The default value to be used for conversion in case of failure. - /// The enumerable of strings to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the strings. - public static IEnumerable ToNuint(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNuint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Nuint.cs b/lib/YANLib/Nullable/YANNum.Nuint.cs index 96eb7c1e..aee82fdd 100644 --- a/lib/YANLib/Nullable/YANNum.Nuint.cs +++ b/lib/YANLib/Nullable/YANNum.Nuint.cs @@ -111,28 +111,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an enumerable of values, which represent the unsigned integer equivalent of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the objects. - public static IEnumerable ToNuint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNuint(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -213,24 +191,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an enumerable of values, which represent the unsigned integer equivalent of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// The enumerable of strings to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the strings. - public static IEnumerable ToNuint(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNuint(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -333,29 +293,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an enumerable of values, which represent the unsigned integer equivalent of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for conversion. - /// Must be a value type. - /// - /// The default value to be used for conversion in case of failure. - /// The enumerable of strings to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the strings. - public static IEnumerable ToNuint(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNuint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Sbyte.Nullable.cs b/lib/YANLib/Nullable/YANNum.Sbyte.Nullable.cs index e47dc585..a43d9392 100644 --- a/lib/YANLib/Nullable/YANNum.Sbyte.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Sbyte.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the signed byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the signed byte representations of the objects. - public static IEnumerable ToSbyte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToSbyte(); - } - } - /// /// Parses the string representation of an using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the signed byte representations of the strings, using the specified default value for invalid string representations. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid string representations. - /// Must be a value type. - /// - /// The default value to be used for invalid string representations. - /// The enumerable of strings to be converted. - /// An containing the signed byte representations of the strings. - public static IEnumerable ToSbyte(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToSbyte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Sbyte.cs b/lib/YANLib/Nullable/YANNum.Sbyte.cs index 9df13e25..427d8eaa 100644 --- a/lib/YANLib/Nullable/YANNum.Sbyte.cs +++ b/lib/YANLib/Nullable/YANNum.Sbyte.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the signed byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the signed byte representations of the objects. - public static IEnumerable ToSbyte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToSbyte(); - } - } - /// /// Parses the string representation of a signed byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the signed byte representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the signed byte representations of the strings. - public static IEnumerable ToSbyte(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToSbyte(); - } - } - /// /// Parses the string representation of a signed byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the signed byte representations of the strings, using the specified default value for invalid string representations. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid string representations. - /// Must be a value type. - /// - /// The default value to be used for invalid string representations. - /// The enumerable of strings to be converted. - /// An containing the signed byte representations of the strings. - public static IEnumerable ToSbyte(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToSbyte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Short.Nullable.cs b/lib/YANLib/Nullable/YANNum.Short.Nullable.cs index d6cc00da..20895f7a 100644 --- a/lib/YANLib/Nullable/YANNum.Short.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Short.Nullable.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the short integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the short integer representations of the objects. - public static IEnumerable ToShort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToShort(); - } - } - /// /// Parses the string representation of a short using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the short integer representations of the strings, using the specified default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the short integer representations of the strings. - public static IEnumerable ToShort(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToShort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Short.cs b/lib/YANLib/Nullable/YANNum.Short.cs index b39190e4..b443f54a 100644 --- a/lib/YANLib/Nullable/YANNum.Short.cs +++ b/lib/YANLib/Nullable/YANNum.Short.cs @@ -109,28 +109,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the short integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the short integer representations of the objects. - public static IEnumerable ToShort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToShort(); - } - } - /// /// Parses the string representation of a short integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the short integer representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the short integer representations of the strings. - public static IEnumerable ToShort(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToShort(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the short integer representations of the strings, using the specified default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the short integer representations of the strings. - public static IEnumerable ToShort(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToShort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Uint.Nullable.cs b/lib/YANLib/Nullable/YANNum.Uint.Nullable.cs index 526d86a7..cd1961e6 100644 --- a/lib/YANLib/Nullable/YANNum.Uint.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Uint.Nullable.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToUint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUint(); - } - } - /// /// Parses the string representation of an unsigned integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the uint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for the conversion to uint. - /// Must be a value type. - /// - /// The default value for the conversion to uint. - /// The enumerable of strings to be converted. - /// An containing the uint representations of the strings. - public static IEnumerable ToUint(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Uint.cs b/lib/YANLib/Nullable/YANNum.Uint.cs index 8c4fe1e4..c77648a8 100644 --- a/lib/YANLib/Nullable/YANNum.Uint.cs +++ b/lib/YANLib/Nullable/YANNum.Uint.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToUint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUint(); - } - } - /// /// Parses the string representation of an unsigned integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the uint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the uint representations of the strings. - public static IEnumerable ToUint(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUint(); - } - } - /// /// Parses the string representation of an unsigned integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the uint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for the conversion to uint. - /// Must be a value type. - /// - /// The default value for the conversion to uint. - /// The enumerable of strings to be converted. - /// An containing the uint representations of the strings. - public static IEnumerable ToUint(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Ulong.Nullable.cs b/lib/YANLib/Nullable/YANNum.Ulong.Nullable.cs index eedbfea7..8843b2f3 100644 --- a/lib/YANLib/Nullable/YANNum.Ulong.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Ulong.Nullable.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ulong representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ulong representations of the objects. - public static IEnumerable ToUlong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUlong(); - } - } - /// /// Parses the string representation of an unsigned long integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the ulong representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used when converting strings to ulong. - /// Must be a value type. - /// - /// The default value to be used when converting strings to ulong. - /// The enumerable of strings to be converted. - /// An containing the ulong representations of the strings. - public static IEnumerable ToUlong(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUlong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Ulong.cs b/lib/YANLib/Nullable/YANNum.Ulong.cs index 950a77b1..ea7f159a 100644 --- a/lib/YANLib/Nullable/YANNum.Ulong.cs +++ b/lib/YANLib/Nullable/YANNum.Ulong.cs @@ -111,28 +111,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ulong representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ulong representations of the objects. - public static IEnumerable ToUlong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUlong(); - } - } - /// /// Parses the string representation of an unsigned long integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -213,24 +191,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the ulong representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the ulong representations of the strings. - public static IEnumerable ToUlong(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUlong(); - } - } - /// /// Parses the string representation of an using the default format. /// Returns the parsed value, or if the parsing fails. @@ -333,29 +293,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the ulong representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used when converting strings to ulong. - /// Must be a value type. - /// - /// The default value to be used when converting strings to ulong. - /// The enumerable of strings to be converted. - /// An containing the ulong representations of the strings. - public static IEnumerable ToUlong(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUlong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Ushort.Nullable.cs b/lib/YANLib/Nullable/YANNum.Ushort.Nullable.cs index 0c03af68..87c0aecc 100644 --- a/lib/YANLib/Nullable/YANNum.Ushort.Nullable.cs +++ b/lib/YANLib/Nullable/YANNum.Ushort.Nullable.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ushort representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ushort representations of the objects. - public static IEnumerable ToUshort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUshort(); - } - } - /// /// Parses the string representation of a ushort using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the ushort representations of the strings, using the specified default value for conversion failure. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failure. - /// Must be a value type. - /// - /// The default value to be used for conversion failure. - /// The enumerable of strings to be converted. - /// An containing the ushort representations of the strings. - public static IEnumerable ToUshort(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUshort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/Nullable/YANNum.Ushort.cs b/lib/YANLib/Nullable/YANNum.Ushort.cs index 928f327c..255c27b9 100644 --- a/lib/YANLib/Nullable/YANNum.Ushort.cs +++ b/lib/YANLib/Nullable/YANNum.Ushort.cs @@ -109,28 +109,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ushort representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ushort representations of the objects. - public static IEnumerable ToUshort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUshort(); - } - } - /// /// Parses the string representation of an unsigned short integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the ushort representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the ushort representations of the strings. - public static IEnumerable ToUshort(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUshort(); - } - } - /// /// Parses the string representation of an unsigned short using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static partial class YANNum } } - /// - /// Converts an enumerable of strings to an containing the ushort representations of the strings, using the specified default value for conversion failure. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failure. - /// Must be a value type. - /// - /// The default value to be used for conversion failure. - /// The enumerable of strings to be converted. - /// An containing the ushort representations of the strings. - public static IEnumerable ToUshort(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUshort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANBool.cs b/lib/YANLib/YANBool.cs index 18ce8b18..5621b124 100644 --- a/lib/YANLib/YANBool.cs +++ b/lib/YANLib/YANBool.cs @@ -9,7 +9,7 @@ public static partial class YANBool /// Returns or with equal probability. /// /// A random boolean value. - public static bool GenerateRandomBool() => GenerateRandomByte(0, 2) == 1; + public static bool GenerateRandomBool() => GenerateRandomByte(0, 2) is 1; /// /// Generates an containing random boolean values. diff --git a/lib/YANLib/YANDateTime.Nullable.cs b/lib/YANLib/YANDateTime.Nullable.cs index dd6d81b0..db01c618 100644 --- a/lib/YANLib/YANDateTime.Nullable.cs +++ b/lib/YANLib/YANDateTime.Nullable.cs @@ -98,27 +98,6 @@ public static IEnumerable ToDateTime(IReadOnlyList strs, strin } } - /// - /// Converts an enumerable of strings representing date/time values in a specified format to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// If a string cannot be parsed to a valid DateTime value, the default value specified by is used instead. - /// - /// The format of the date/time values in the input strings. - /// The default DateTime value to be used for strings that cannot be parsed to valid DateTime values. - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs, string fmt, DateTime? dfltVal) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(fmt, dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. @@ -358,24 +337,6 @@ public static IEnumerable GetWeekOfYear(this IReadOnlyList dts) } } - /// - /// Gets the week of the year for an enumerable of DateTime values using the default calendar of the current culture. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The enumerable of DateTime values for which to get the week of the year. - /// An containing the week of the year values for the input DateTime values. - public static IEnumerable GetWeekOfYear(this IReadOnlySet dts) - { - if (dts is null || dts.Count > 0) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.GetWeekOfYear(); - } - } - /// /// Returns the total number of months between the two specified values, ignoring the day of the month. /// @@ -503,29 +464,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -649,29 +587,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -795,29 +710,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -941,29 +833,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1087,29 +956,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1233,29 +1079,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1379,29 +1202,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns an containing the values converted to a different time zone, based on the source and destination time zones specified. - /// The source and destination time zones are specified as generic type parameters and respectively, and must be of a struct type that represents a valid time zone identifier. - /// If any of the input values is , no value will be returned for that input. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The values to convert to the destination time zone. - /// An containing the values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1? tzSrc, T2? tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -1507,25 +1307,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - /// - /// The type of the time zone offset to convert the original value to, which must be a value type. - /// The original value. - /// The time zone offset to convert the original value to, in hours. - /// A new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Converts a list of DateTime values from one time zone to another using the specified destination time zone, and updates the original list in place with the DateTime values converted to the destination time zone. /// If the input list is or empty, no changes will be made. @@ -1629,25 +1410,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - /// - /// The type of the time zone offset to convert the original value to, which must be a value type. - /// The original value. - /// The time zone offset to convert the original value to, in hours. - /// A new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T? tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Converts a list of DateTime values from one time zone to another using the specified destination time zone, and updates the original list in place with the DateTime values converted to the destination time zone. /// If the input list is or empty, no changes will be made. @@ -1751,25 +1513,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Returns a new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - /// - /// The type of the time zone offset to convert the original value to, which must be a value type. - /// The original value. - /// The time zone offset to convert the original value to, in hours. - /// A new value representing the same point in time as the original value, but converted to a different time zone with a time zone offset of 0. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T? tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Converts a list of DateTime values from one time zone to another using the specified destination time zone, and updates the original list in place with the DateTime values converted to the destination time zone. /// If the input list is or empty, no changes will be made. diff --git a/lib/YANLib/YANDateTime.cs b/lib/YANLib/YANDateTime.cs index 8c41016c..f98c52fb 100644 --- a/lib/YANLib/YANDateTime.cs +++ b/lib/YANLib/YANDateTime.cs @@ -89,24 +89,6 @@ public static IEnumerable ToDateTime(IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings representing date/time values to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(); - } - } - /// /// Parses the string representation of a date and time using . /// Returns the parsed value, or if the parsing fails. @@ -192,25 +174,6 @@ public static IEnumerable ToDateTime(IReadOnlyList strs, strin } } - /// - /// Converts an enumerable of strings representing date/time values in a specified format to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// - /// The format of the date/time values in the input strings. - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs, string fmt) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(fmt); - } - } - /// /// Parses the string representation of a date and time using . /// Returns the parsed value, or if the parsing fails. @@ -305,27 +268,6 @@ public static IEnumerable ToDateTime(IReadOnlyList strs, strin } } - /// - /// Converts an enumerable of strings representing date/time values in a specified format to an containing the parsed DateTime values. - /// Returns an empty sequence if the input enumerable is , empty, or contains only whitespace strings. - /// If a string cannot be parsed to a valid DateTime value, the default value specified by is used instead. - /// - /// The format of the date/time values in the input strings. - /// The default DateTime value to be used for strings that cannot be parsed to valid DateTime values. - /// The enumerable of strings to convert to DateTime values. - /// An containing the parsed DateTime values. - public static IEnumerable ToDateTime(IReadOnlySet strs, string fmt, DateTime dfltVal) - { - if (strs.IsNullOrWhiteSpace()) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToDateTime(fmt, dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. @@ -448,24 +390,6 @@ public static IEnumerable GetWeekOfYear(this IReadOnlyList dts) } } - /// - /// Gets the week of the year for an enumerable of DateTime values using the default calendar of the current culture. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The enumerable of DateTime values for which to get the week of the year. - /// An containing the week of the year values for the input DateTime values. - public static IEnumerable GetWeekOfYear(this IReadOnlySet dts) - { - if (dts is null || dts.Count > 0) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.GetWeekOfYear(); - } - } - /// /// Returns the total number of months between the two specified values, ignoring the day of the month. /// @@ -582,28 +506,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Converts an enumerable of DateTime values from one time zone to another using the specified source and destination time zones. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone to convert from. - /// The destination time zone to convert to. - /// The enumerable of DateTime values to convert. - /// An containing the DateTime values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T1 tzSrc, T2 tzDst) where T1 : struct where T2 : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzSrc, tzDst); - } - } - /// /// Converts an list of DateTime values from one time zone to another using the specified source and destination time zones, and updates the original list in-place. /// If the input list is or empty, no action is taken. @@ -713,26 +615,6 @@ public static IEnumerable ChangeTimeZone(this IReadOnlyList - /// Converts an array of DateTime values from one time zone to another using the specified destination time zone, and returns an containing the DateTime values converted to the destination time zone. - /// Returns an empty sequence if the input array is or empty. - /// - /// The type of the destination time zone. - /// The destination time zone to convert to. - /// The array of DateTime values to convert. - /// An containing the DateTime values converted to the destination time zone. - public static IEnumerable ChangeTimeZone(this IReadOnlySet dts, T tzDst) where T : struct - { - if (dts is null || dts.Count < 1) - { - yield break; - } - foreach (var dt in dts) - { - yield return dt.ChangeTimeZone(tzDst); - } - } - /// /// Converts a list of DateTime values from one time zone to another using the specified destination time zone, and updates the original list in place with the DateTime values converted to the destination time zone. /// If the input list is or empty, no changes will be made. diff --git a/lib/YANLib/YANEnumerable.cs b/lib/YANLib/YANEnumerable.cs index c5a64be2..78b490df 100644 --- a/lib/YANLib/YANEnumerable.cs +++ b/lib/YANLib/YANEnumerable.cs @@ -44,12 +44,12 @@ public static IEnumerable Clean(params T[] srcs) } var t = typeof(T); var cnt = srcs.Length; - if (t.IsClass || GetUnderlyingType(t) != null) + if (t.IsClass || GetUnderlyingType(t) is not null) { for (var i = 0; i < cnt; i++) { var src = srcs[i]; - if (src != null) + if (src is not null) { yield return src; } @@ -79,11 +79,11 @@ public static IEnumerable Clean(this IEnumerable srcs) yield break; } var t = typeof(T); - if (t.IsClass || GetUnderlyingType(t) != null) + if (t.IsClass || GetUnderlyingType(t) is not null) { foreach (var src in srcs) { - if (src != null) + if (src is not null) { yield return src; } @@ -113,11 +113,11 @@ public static IEnumerable Clean(this IReadOnlyCollection srcs) yield break; } var t = typeof(T); - if (t.IsClass || GetUnderlyingType(t) != null) + if (t.IsClass || GetUnderlyingType(t) is not null) { foreach (var src in srcs) { - if (src != null) + if (src is not null) { yield return src; } @@ -148,12 +148,12 @@ public static IEnumerable Clean(this IReadOnlyList srcs) } var t = typeof(T); var cnt = srcs.Count; - if (t.IsClass || GetUnderlyingType(t) != null) + if (t.IsClass || GetUnderlyingType(t) is not null) { for (var i = 0; i < cnt; i++) { var src = srcs[i]; - if (src != null) + if (src is not null) { yield return src; } @@ -168,40 +168,6 @@ public static IEnumerable Clean(this IReadOnlyList srcs) } } - /// - /// Removes values from the specified objects and returns an containing the non-null values. - /// If the type is a class or a nullable value type, the method checks for values and excludes them. - /// If is a non-nullable value type, the method returns all objects in the input enumerable without modification. - /// - /// The type of the objects to clean. - /// The objects to clean. - /// An containing the non-null values. - public static IEnumerable Clean(this IReadOnlySet srcs) - { - if (srcs is null || srcs.Count < 1) - { - yield break; - } - var t = typeof(T); - if (t.IsClass || GetUnderlyingType(t) != null) - { - foreach (var src in srcs) - { - if (src != null) - { - yield return src; - } - } - } - else - { - foreach (var src in srcs) - { - yield return src; - } - } - } - /// /// Removes values from the specified collection of objects and modifies the collection in-place, by removing the null values. /// If the type is a class or a nullable value type, the method checks for values and removes them from the collection. @@ -214,11 +180,11 @@ public static void CleanRef(this ICollection srcs) if (srcs is not null && srcs.Any()) { var t = typeof(T); - if (t.IsClass || GetUnderlyingType(t) != null) + if (t.IsClass || GetUnderlyingType(t) is not null) { foreach (var src in srcs) { - if(src != null) + if (src is not null) { _ = srcs.Remove(src); } @@ -240,11 +206,11 @@ public static void CleanRef(this IList srcs) { var t = typeof(T); var cnt = srcs.Count; - if (t.IsClass || GetUnderlyingType(t) != null) + if (t.IsClass || GetUnderlyingType(t) is not null) { for (var i = 0; i < cnt; i++) { - if (srcs[i] != null) + if (srcs[i] is not null) { srcs.RemoveAt(i); } @@ -253,31 +219,6 @@ public static void CleanRef(this IList srcs) } } - /// - /// Removes values from the specified collection of objects and modifies the collection in-place, by removing the null values. - /// If the type is a class or a nullable value type, the method checks for values and removes them from the collection. - /// If is a non-nullable value type, the method does not modify the collection. - /// - /// The type of the objects in the collection. - /// The collection of objects to clean. - public static void CleanRef(this ISet srcs) - { - if (srcs is not null && srcs.Count > 0) - { - var t = typeof(T); - if (t.IsClass || GetUnderlyingType(t) != null) - { - foreach (var src in srcs) - { - if (src != null) - { - _ = srcs.Remove(src); - } - } - } - } - } - /// /// Removes values and empty strings from the specified enumerable of strings, and returns an containing the non-null and non-empty strings. /// @@ -362,26 +303,6 @@ public static IEnumerable Clean(this IReadOnlyList srcs) } } - /// - /// Removes values and empty strings from the specified enumerable of strings, and returns an containing the non-null and non-empty strings. - /// - /// The enumerable of strings to clean. - /// An containing the non-null and non-empty strings. - public static IEnumerable Clean(this IReadOnlySet srcs) - { - if (srcs is null || srcs.Count < 1) - { - yield break; - } - foreach (var src in srcs) - { - if (src.IsNotNullAndWhiteSpace()) - { - yield return src; - } - } - } - /// /// Removes or whitespace values from the specified collection of strings and modifies the collection in-place, by removing the null or whitespace values. /// If the string value is not null or whitespace, the method checks for whitespace values using method and removes them from the collection. @@ -420,22 +341,22 @@ public static void CleanRef(this IList srcs) } } - /// - /// Removes or whitespace values from the specified collection of strings and modifies the collection in-place, by removing the null or whitespace values. - /// If the string value is not null or whitespace, the method checks for whitespace values using method and removes them from the collection. - /// - /// The collection of strings to clean. - public static void CleanRef(this ISet srcs) + public static Dictionary? CreateDictionary(IEnumerable keys, IEnumerable values) where TKey : notnull { - if (srcs is not null && srcs.Count > 0) + if (keys is not null && values is not null && keys.Any() && values.Any()) { - foreach (var src in srcs) + var keyList = keys.ToList(); + var valueList = values.ToList(); + if (keyList.Count > 0 && keyList.Count == keyList.Distinct().Count() && valueList.Count >= keyList.Count) { - if (src.IsNotNullAndWhiteSpace()) + var rslt = new Dictionary(keyList.Count); + for (var i = 0; i < keyList.Count; i++) { - _ = srcs.Remove(src); + rslt.Add(keyList[i], valueList[i]); } + return rslt; } } + return default; } } diff --git a/lib/YANLib/YANFunc.cs b/lib/YANLib/YANFunc.cs index 83422a46..ce950532 100644 --- a/lib/YANLib/YANFunc.cs +++ b/lib/YANLib/YANFunc.cs @@ -11,30 +11,11 @@ public static async ValueTask> AggregateResultsConcurrently { + var item = func(arg); await semSlim.WaitAsync(); try { - rslts.Add(func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IEnumerable args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); + rslts.Add(item); } finally { @@ -51,270 +32,11 @@ public static async ValueTask> AggregateResultsConcurrently { + var item = func(arg, coll); await semSlim.WaitAsync(); try { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IEnumerable args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IEnumerable args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IEnumerable args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func func, IReadOnlyCollection args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyCollection args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyCollection args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyCollection args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyCollection args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyCollection args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func func, IReadOnlyList args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyList args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyList args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyList args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); + rslts.Add(item); } finally { @@ -325,16 +47,17 @@ public static async ValueTask> AggregateResultsConcurrently> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyList args, IReadOnlyList coll) + public static async ValueTask> AggregateResultsConcurrently(Func> func, IEnumerable args) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var item = await func(arg); await semSlim.WaitAsync(); try { - rslts.Add(func(arg, coll)); + rslts.Add(item); } finally { @@ -345,16 +68,17 @@ public static async ValueTask> AggregateResultsConcurrently> AggregateResultsConcurrently(Func, TResult> func, IReadOnlyList args, IReadOnlySet coll) + public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IEnumerable args, IEnumerable coll) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var item = await func(arg, coll); await semSlim.WaitAsync(); try { - rslts.Add(func(arg, coll)); + rslts.Add(item); } finally { @@ -365,16 +89,17 @@ public static async ValueTask> AggregateResultsConcurrently> AggregateResultsConcurrently(Func func, IReadOnlySet args) + public static async ValueTask> AggregateResultsConcurrently(Func> func, IEnumerable args) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var item = await func(arg); await semSlim.WaitAsync(); try { - rslts.Add(func(arg)); + rslts.Add(item); } finally { @@ -385,1056 +110,17 @@ public static async ValueTask> AggregateResultsConcurrently> AggregateResultsConcurrently(Func, TResult> func, IReadOnlySet args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlySet args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlySet args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlySet args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, TResult> func, IReadOnlySet args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IEnumerable args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IEnumerable args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IEnumerable args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IEnumerable args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IEnumerable args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IEnumerable args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IReadOnlyCollection args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyCollection args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyCollection args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyCollection args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyCollection args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyCollection args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IReadOnlyList args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyList args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyList args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyList args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyList args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlyList args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IReadOnlySet args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlySet args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlySet args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlySet args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlySet args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, ValueTask> func, IReadOnlySet args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IEnumerable args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IEnumerable args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IEnumerable args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IEnumerable args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IEnumerable args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IEnumerable args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IReadOnlyCollection args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyCollection args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyCollection args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyCollection args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyCollection args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyCollection args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IReadOnlyList args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyList args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyList args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyList args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyList args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlyList args, IReadOnlySet coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func> func, IReadOnlySet args) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlySet args, params Ts[] coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlySet args, IEnumerable coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlySet args, IReadOnlyCollection coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlySet args, IReadOnlyList coll) - { - var rslts = new List(); - var semSlim = new SemaphoreSlim(ProcessorCount); - var tasks = args.Select(async arg => - { - await semSlim.WaitAsync(); - try - { - rslts.Add(await func(arg, coll)); - } - finally - { - _ = semSlim.Release(); - } - }); - await WhenAll(tasks); - return rslts; - } - - public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IReadOnlySet args, IReadOnlySet coll) + public static async ValueTask> AggregateResultsConcurrently(Func, Task> func, IEnumerable args, IEnumerable coll) { var rslts = new List(); var semSlim = new SemaphoreSlim(ProcessorCount); var tasks = args.Select(async arg => { + var item = await func(arg, coll); await semSlim.WaitAsync(); try { - rslts.Add(await func(arg, coll)); + rslts.Add(item); } finally { diff --git a/lib/YANLib/YANJson.cs b/lib/YANLib/YANJson.cs index b1d29bff..58c1e964 100644 --- a/lib/YANLib/YANJson.cs +++ b/lib/YANLib/YANJson.cs @@ -104,28 +104,6 @@ public static IEnumerable Serialize(this IReadOnlyList mdls) where } } - /// - /// Serializes an enumerable of objects of type to an containing JSON strings representing the serialized objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the objects to be serialized. - /// Must be a reference type. - /// - /// The enumerable of objects to be serialized. - /// An containing JSON strings representing the serialized objects. - public static IEnumerable Serialize(this IReadOnlySet mdls) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.Serialize(); - } - } - /// /// Serializes the given object of type to a JSON string using the default JSON serialization settings, /// with the property names in camelCase and case sensitivity for property names set to false. @@ -234,29 +212,6 @@ public static IEnumerable SerializeCamel(this IReadOnlyList mdls) } } - /// - /// Serializes an enumerable of objects of type to an containing JSON strings representing the serialized objects, - /// with the property names in camelCase and case sensitivity for property names set to false. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the objects to be serialized. - /// Must be a reference type. - /// - /// The enumerable of objects to be serialized. - /// An containing JSON strings representing the serialized objects with camelCase property names and case sensitivity for property names set to false. - public static IEnumerable SerializeCamel(this IReadOnlySet mdls) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.SerializeCamel(); - } - } - /// /// Deserializes a JSON string to an object of type using the default JSON deserialization settings. /// Returns the deserialized object, or if the deserialization fails. @@ -367,28 +322,6 @@ public static IEnumerable SerializeCamel(this IReadOnlySet mdls) w } } - /// - /// Deserializes an array of JSON strings to an enumerable of objects of type using the default JSON deserialization settings. - /// Returns an enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - /// - /// - /// The type of the objects to be deserialized. - /// Must be a reference type. - /// - /// The array of JSON strings to be deserialized. - /// An enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - public static IEnumerable Deserialize(this IReadOnlySet strs) where T : class - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.Deserialize(); - } - } - /// /// Deserializes a JSON string to an object of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false. /// Returns the deserialized object, or if the deserialization fails. @@ -503,28 +436,6 @@ public static IEnumerable SerializeCamel(this IReadOnlySet mdls) w } } - /// - /// Deserializes an array of JSON strings to an enumerable of objects of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false. - /// Returns an enumerable of deserialized objects, or an empty sequence if the input array is , empty, or contains only strings. - /// - /// - /// The type of the objects to be deserialized. - /// Must be a reference type. - /// - /// The array of JSON strings to be deserialized. - /// An enumerable of deserialized objects, or an empty sequence if the input array is , empty, or contains only strings. - public static IEnumerable DeserializeCamel(this IReadOnlySet strs) where T : class - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.DeserializeCamel(); - } - } - /// /// Deserializes a JSON string to an object of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false as additional options. /// If the deserialization fails, returns . @@ -651,28 +562,6 @@ public static IEnumerable SerializeCamel(this IReadOnlySet mdls) w } } - /// - /// Deserializes an array of JSON strings to an enumerable of objects of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false as additional options. - /// Returns an enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - /// - /// - /// The type of the objects to be deserialized. - /// Must be a reference type. - /// - /// The array of JSON strings to be deserialized. - /// An enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - public static IEnumerable DeserializeDuo(this IReadOnlySet strs) where T : class - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.DeserializeDuo(); - } - } - /// /// Deserializes a JSON string to an object of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false as additional options. /// If the deserialization fails, returns . @@ -799,28 +688,6 @@ public static IEnumerable SerializeCamel(this IReadOnlySet mdls) w } } - /// - /// Deserializes an array of JSON strings to an enumerable of objects of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false as additional options. - /// Returns an enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - /// - /// - /// The type of the objects to be deserialized. - /// Must be a reference type. - /// - /// The array of JSON strings to be deserialized. - /// An enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - public static IEnumerable DeserializeDuoCamelPriority(this IReadOnlySet strs) where T : class - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.DeserializeDuoCamelPriority(); - } - } - /// /// Deserializes a JSON string to an object of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false as additional options. /// If the deserialization fails, returns . @@ -934,24 +801,4 @@ public static IEnumerable SerializeCamel(this IReadOnlySet mdls) w yield return strs[i].DeserializeStandard(); } } - - /// - /// Deserializes an array of JSON strings to an enumerable of objects of type using the default JSON deserialization settings, with camelCase property names and case sensitivity for property names set to false as additional options. - /// Returns an enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - /// - /// The type of the objects to be deserialized.Must be a reference type. - /// - /// The array of JSON strings to be deserialized. - /// An enumerable of deserialized objects, or if the deserialization fails for any of the input strings. - public static IEnumerable DeserializeStandard(this IReadOnlySet strs) where T : class - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.DeserializeStandard(); - } - } } diff --git a/lib/YANLib/YANModel.Property.cs b/lib/YANLib/YANModel.Property.cs index 7d456d53..f2f8cf37 100644 --- a/lib/YANLib/YANModel.Property.cs +++ b/lib/YANLib/YANModel.Property.cs @@ -105,25 +105,6 @@ public static IEnumerable AllPropertiesNotDefault(this IReadOnlyList } } - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// An containing or for each object, indicating whether all properties have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlySet mdls) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(); - } - } - /// /// Checks whether all properties of the specified object have default values, including all its nested properties and properties in lists. /// If the object is , returns . @@ -224,25 +205,6 @@ public static IEnumerable AllPropertiesDefault(this IReadOnlyList md } } - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// An containing or for each object, indicating whether all properties have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlySet mdls) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(); - } - } - /// /// Checks whether any property of the specified object has a value other than the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -343,25 +305,6 @@ public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyList } } - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// An containing or for each object, indicating whether any property has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlySet mdls) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(); - } - } - /// /// Checks whether any property of the specified object has a value equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -462,25 +405,6 @@ public static IEnumerable AnyPropertiesDefault(this IReadOnlyList md } } - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// An containing or for each object, indicating whether any property has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlySet mdls) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(); - } - } - /// /// Checks whether all properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -566,26 +490,6 @@ public static IEnumerable AllPropertiesNotDefault(this IReadOnlyList } } - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlySet mdls, params string[] names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - /// /// Checks whether all properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -671,26 +575,6 @@ public static IEnumerable AllPropertiesDefault(this IReadOnlyList md } } - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlySet mdls, params string[] names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - /// /// Checks whether any properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -776,26 +660,6 @@ public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyList } } - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlySet mdls, params string[] names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - /// /// Checks whether any properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -881,26 +745,6 @@ public static IEnumerable AnyPropertiesDefault(this IReadOnlyList md } } - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlySet mdls, params string[] names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - /// /// Checks whether all properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -1006,26 +850,6 @@ public static IEnumerable AllPropertiesNotDefault(this IReadOnlyList } } - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlySet mdls, IEnumerable names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - /// /// Checks whether all properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -1131,26 +955,6 @@ public static IEnumerable AllPropertiesDefault(this IReadOnlyList md } } - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlySet mdls, IEnumerable names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - /// /// Checks whether any properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -1256,26 +1060,6 @@ public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyList } } - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlySet mdls, IEnumerable names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - /// /// Checks whether any properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -1380,1524 +1164,4 @@ public static IEnumerable AnyPropertiesDefault(this IReadOnlyList md yield return mdls[i].AnyPropertiesDefault(names); } } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlySet mdls, IEnumerable names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if all properties with the specified names of the specified object have values that are not equal to the default value; otherwise, . - public static bool AllPropertiesNotDefault(this T mdl, IReadOnlyCollection names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return false; - } - } - return true; - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(IReadOnlyCollection names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IEnumerable mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlyCollection mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlyList mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlySet mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if all properties with the specified names of the specified object have values that are equal to the default value; otherwise, . - public static bool AllPropertiesDefault(this T mdl, IReadOnlyCollection names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (!EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return false; - } - } - return true; - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(IReadOnlyCollection names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IEnumerable mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlyCollection mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlyList mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlySet mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether any properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if any properties with the specified names of the specified object have values that are not equal to the default value; otherwise, . - public static bool AnyPropertiesNotDefault(this T mdl, IReadOnlyCollection names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (!EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return true; - } - } - return false; - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(IReadOnlyCollection names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IEnumerable mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyCollection mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyList mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlySet mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if any properties with the specified names of the specified object have values that are equal to the default value; otherwise, . - public static bool AnyPropertiesDefault(this T mdl, IReadOnlyCollection names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return true; - } - } - return false; - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(IReadOnlyCollection names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IEnumerable mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlyCollection mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlyList mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlySet mdls, IReadOnlyCollection names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if all properties with the specified names of the specified object have values that are not equal to the default value; otherwise, . - public static bool AllPropertiesNotDefault(this T mdl, IReadOnlyList names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return false; - } - } - return true; - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(IReadOnlyList names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IEnumerable mdls, IReadOnlyList names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlyCollection mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlyList mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlySet mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if all properties with the specified names of the specified object have values that are equal to the default value; otherwise, . - public static bool AllPropertiesDefault(this T mdl, IReadOnlyList names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (!EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return false; - } - } - return true; - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(IReadOnlyList names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IEnumerable mdls, IReadOnlyList names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlyCollection mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlyList mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlySet mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether any properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if any properties with the specified names of the specified object have values that are not equal to the default value; otherwise, . - public static bool AnyPropertiesNotDefault(this T mdl, IReadOnlyList names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (!EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return true; - } - } - return false; - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(IReadOnlyList names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IEnumerable mdls, IReadOnlyList names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyCollection mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyList mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlySet mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if any properties with the specified names of the specified object have values that are equal to the default value; otherwise, . - public static bool AnyPropertiesDefault(this T mdl, IReadOnlyList names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return true; - } - } - return false; - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(IReadOnlyList names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IEnumerable mdls, IReadOnlyList names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlyCollection mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlyList mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlySet mdls, IReadOnlyList names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if all properties with the specified names of the specified object have values that are not equal to the default value; otherwise, . - public static bool AllPropertiesNotDefault(this T mdl, IReadOnlySet names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return false; - } - } - return true; - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(IReadOnlySet names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IEnumerable mdls, IReadOnlySet names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlyCollection mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlyList mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have non-default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have non-default values. - public static IEnumerable AllPropertiesNotDefault(this IReadOnlySet mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesNotDefault(names); - } - } - - /// - /// Checks whether all properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if all properties with the specified names of the specified object have values that are equal to the default value; otherwise, . - public static bool AllPropertiesDefault(this T mdl, IReadOnlySet names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (!EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return false; - } - } - return true; - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(IReadOnlySet names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IEnumerable mdls, IReadOnlySet names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlyCollection mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlyList mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AllPropertiesDefault(names); - } - } - - /// - /// Checks whether all properties of the specified objects have default values, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether all properties, except for the specified names, have default values. - public static IEnumerable AllPropertiesDefault(this IReadOnlySet mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AllPropertiesDefault(names); - } - } - - /// - /// Checks whether any properties with the specified names of the specified object have values that are not equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if any properties with the specified names of the specified object have values that are not equal to the default value; otherwise, . - public static bool AnyPropertiesNotDefault(this T mdl, IReadOnlySet names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (!EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return true; - } - } - return false; - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(IReadOnlySet names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IEnumerable mdls, IReadOnlySet names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyCollection mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlyList mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a non-default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a non-default value. - public static IEnumerable AnyPropertiesNotDefault(this IReadOnlySet mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesNotDefault(names); - } - } - - /// - /// Checks whether any properties with the specified names of the specified object have values that are equal to the default value, including all its nested properties and properties in lists. - /// If the object is , returns . - /// - /// The type of the object to check. - /// The object to check. - /// The names of the properties to check. - /// if any properties with the specified names of the specified object have values that are equal to the default value; otherwise, . - public static bool AnyPropertiesDefault(this T mdl, IReadOnlySet names) where T : class - { - if (mdl is null || names.IsNullOrWhiteSpace()) - { - return false; - } - foreach (var prop in mdl.GetType().GetProperties(Public | Instance | DeclaredOnly).Where(p => names.Contains(p.Name))) - { - var type = prop.PropertyType; - if (EqualityComparer.Default.Equals(prop.GetValue(mdl), type.IsValueType ? CreateInstance(type) : default)) - { - return true; - } - } - return false; - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(IReadOnlySet names, params T[] mdls) where T : class - { - if (mdls is null || mdls.Length < 1) - { - yield break; - } - for (var i = 0; i < mdls.Length; i++) - { - yield return mdls[i].AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IEnumerable mdls, IReadOnlySet names) where T : class - { - if (mdls is null || !mdls.Any()) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlyCollection mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlyList mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - for (var i = 0; i < mdls.Count; i++) - { - yield return mdls[i].AnyPropertiesDefault(names); - } - } - - /// - /// Checks whether any property of the specified objects has a default value, including all their nested properties and properties in lists, except for properties with the specified names. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to check. - /// The objects to check. - /// The names of properties to exclude from the check. - /// An containing or for each object, indicating whether any property, except for the specified names, has a default value. - public static IEnumerable AnyPropertiesDefault(this IReadOnlySet mdls, IReadOnlySet names) where T : class - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.AnyPropertiesDefault(names); - } - } } diff --git a/lib/YANLib/YANModel.cs b/lib/YANLib/YANModel.cs index 13187380..19a97d25 100644 --- a/lib/YANLib/YANModel.cs +++ b/lib/YANLib/YANModel.cs @@ -161,29 +161,6 @@ public static partial class YANModel } } - /// - /// Changes the time zone of all properties of the specified objects in the enumerable with nullable values, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to change the time zone. - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The nullable objects to change the time zone. - /// An containing the nullable objects with all their properties having the specified time zone; or for each object that is in the enumerable. - public static IEnumerable ChangeTimeZoneAllProperties(this IReadOnlySet mdls, T1 tzSrc, T2 tzDst) where T : class where T1 : struct where T2 : struct - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.ChangeTimeZoneAllProperties(tzSrc, tzDst); - } - } - /// /// Changes the time zone of all properties of the specified object with nullable value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -340,29 +317,6 @@ public static partial class YANModel } } - /// - /// Changes the time zone of all properties of the specified objects in the enumerable with nullable values, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to change the time zone. - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The nullable objects to change the time zone. - /// An containing the nullable objects with all their properties having the specified time zone; or for each object that is in the enumerable. - public static IEnumerable ChangeTimeZoneAllProperties(this IReadOnlySet mdls, T1? tzSrc, T2 tzDst) where T : class where T1 : struct where T2 : struct - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.ChangeTimeZoneAllProperties(tzSrc, tzDst); - } - } - /// /// Changes the time zone of all properties of the specified object with nullable value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -519,29 +473,6 @@ public static partial class YANModel } } - /// - /// Changes the time zone of all properties of the specified objects in the enumerable with nullable values, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to change the time zone. - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The nullable objects to change the time zone. - /// An containing the nullable objects with all their properties having the specified time zone; or for each object that is in the enumerable. - public static IEnumerable ChangeTimeZoneAllProperties(this IReadOnlySet mdls, T1 tzSrc, T2? tzDst) where T : class where T1 : struct where T2 : struct - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.ChangeTimeZoneAllProperties(tzSrc, tzDst); - } - } - /// /// Changes the time zone of all properties of the specified object with nullable value, including all its nested properties and properties in lists. /// If the object is , returns . @@ -697,27 +628,4 @@ public static partial class YANModel yield return mdls[i].ChangeTimeZoneAllProperties(tzSrc, tzDst); } } - - /// - /// Changes the time zone of all properties of the specified objects in the enumerable with nullable values, including all their nested properties and properties in lists. - /// If any of the objects is , returns for that object. - /// - /// The type of the objects to change the time zone. - /// The type of the source time zone. - /// The type of the destination time zone. - /// The source time zone. - /// The destination time zone. - /// The nullable objects to change the time zone. - /// An containing the nullable objects with all their properties having the specified time zone; or for each object that is in the enumerable. - public static IEnumerable ChangeTimeZoneAllProperties(this IReadOnlySet mdls, T1? tzSrc, T2? tzDst) where T : class where T1 : struct where T2 : struct - { - if (mdls is null || mdls.Count < 1) - { - yield break; - } - foreach (var mdl in mdls) - { - yield return mdl.ChangeTimeZoneAllProperties(tzSrc, tzDst); - } - } } diff --git a/lib/YANLib/YANNum.Byte.Nullable.cs b/lib/YANLib/YANNum.Byte.Nullable.cs index 082ac0a1..da312243 100644 --- a/lib/YANLib/YANNum.Byte.Nullable.cs +++ b/lib/YANLib/YANNum.Byte.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToByte(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToByte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToByte(); - } - } - /// /// Parses the string representation of a byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToByte(this IReadOnlyList strs, T? df } } - /// - /// Converts an enumerable of string objects to an containing the byte representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the byte representations of the strings. - public static IEnumerable ToByte(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToByte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Byte.cs b/lib/YANLib/YANNum.Byte.cs index 0ca3a1c9..9a09fa49 100644 --- a/lib/YANLib/YANNum.Byte.cs +++ b/lib/YANLib/YANNum.Byte.cs @@ -109,28 +109,6 @@ public static IEnumerable ToByte(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToByte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToByte(); - } - } - /// /// Parses the string representation of a byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToByte(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of string objects to an containing the byte representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// The enumerable of string objects to be converted. - /// An containing the byte representations of the strings. - public static IEnumerable ToByte(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToByte(); - } - } - /// /// Parses the string representation of a byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToByte(this IReadOnlyList strs, T dfl } } - /// - /// Converts an enumerable of string objects to an containing the byte representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the byte representations of the strings. - public static IEnumerable ToByte(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToByte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Decimal.Nullable.cs b/lib/YANLib/YANNum.Decimal.Nullable.cs index 23887099..704d1ea0 100644 --- a/lib/YANLib/YANNum.Decimal.Nullable.cs +++ b/lib/YANLib/YANNum.Decimal.Nullable.cs @@ -105,27 +105,6 @@ public static IEnumerable ToDecimal(this IReadOnlyList nums) whe } } - /// - /// Converts an enumerable of values of a generic value type to an containing the decimal representations of the values. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the values to be converted, which must be a value type. - /// - /// The enumerable of values to be converted. - /// An containing the decimal representations of the values. - public static IEnumerable ToDecimal(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDecimal(); - } - } - /// /// Parses the string representation of a decimal using the default format. /// Returns the parsed value, or if the parsing fails. @@ -228,29 +207,6 @@ public static IEnumerable ToDecimal(this IReadOnlyList strs, } } - /// - /// Converts an enumerable of string objects to an containing the decimal representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the decimal representations of the strings. - public static IEnumerable ToDecimal(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDecimal(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Decimal.cs b/lib/YANLib/YANNum.Decimal.cs index c578aabd..605cf0a1 100644 --- a/lib/YANLib/YANNum.Decimal.cs +++ b/lib/YANLib/YANNum.Decimal.cs @@ -105,27 +105,6 @@ public static IEnumerable ToDecimal(this IReadOnlyList nums) wher } } - /// - /// Converts an enumerable of values of a generic value type to an containing the decimal representations of the values. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the values to be converted, which must be a value type. - /// - /// The enumerable of values to be converted. - /// An containing the decimal representations of the values. - public static IEnumerable ToDecimal(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDecimal(); - } - } - /// /// Parses the string representation of a decimal using the default format. /// Returns the parsed value, or if the parsing fails. @@ -206,24 +185,6 @@ public static IEnumerable ToDecimal(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of string objects to an containing the decimal representations of the strings. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// The enumerable of string objects to be converted. - /// An containing the decimal representations of the strings. - public static IEnumerable ToDecimal(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDecimal(); - } - } - /// /// Parses the string representation of a decimal using the default format. /// Returns the parsed value, or if the parsing fails. @@ -326,29 +287,6 @@ public static IEnumerable ToDecimal(this IReadOnlyList strs, } } - /// - /// Converts an enumerable of string objects to an containing the decimal representations of the strings, using a default value for invalid conversions. - /// Returns an empty sequence if the input enumerable is or empty. - /// - /// - /// The type of the default value to be used for invalid conversions. - /// Must be a value type. - /// - /// The default value to be used for invalid conversions. - /// The enumerable of string objects to be converted. - /// An containing the decimal representations of the strings. - public static IEnumerable ToDecimal(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDecimal(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Double.Nullable.cs b/lib/YANLib/YANNum.Double.Nullable.cs index c91d8b40..ddf0e1ac 100644 --- a/lib/YANLib/YANNum.Double.Nullable.cs +++ b/lib/YANLib/YANNum.Double.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToDouble(this IReadOnlyList nums) where } } - /// - /// Converts an enumerable of value-type objects of type to an containing the double representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the double representations of the objects. - public static IEnumerable ToDouble(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDouble(); - } - } - /// /// Parses the string representation of a double using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToDouble(this IReadOnlyList strs, T } } - /// - /// Converts an enumerable of strings to an containing the double representations of the strings, using a default value for conversion failures. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failures. - /// Must be a value type. - /// - /// The default value to use for conversion failures. - /// The enumerable of strings to be converted. - /// An containing the double representations of the strings. - public static IEnumerable ToDouble(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDouble(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Double.cs b/lib/YANLib/YANNum.Double.cs index 0fc20aca..2fec9636 100644 --- a/lib/YANLib/YANNum.Double.cs +++ b/lib/YANLib/YANNum.Double.cs @@ -109,28 +109,6 @@ public static IEnumerable ToDouble(this IReadOnlyList nums) where } } - /// - /// Converts an enumerable of value-type objects of type to an containing the double representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the double representations of the objects. - public static IEnumerable ToDouble(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToDouble(); - } - } - /// /// Parses the string representation of a double using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToDouble(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the double representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the double representations of the strings. - public static IEnumerable ToDouble(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDouble(); - } - } - /// /// Parses the string representation of a double using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToDouble(this IReadOnlyList strs, T } } - /// - /// Converts an enumerable of strings to an containing the double representations of the strings, using a default value for conversion failures. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failures. - /// Must be a value type. - /// - /// The default value to use for conversion failures. - /// The enumerable of strings to be converted. - /// An containing the double representations of the strings. - public static IEnumerable ToDouble(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToDouble(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Float.Nullable.cs b/lib/YANLib/YANNum.Float.Nullable.cs index aa9a4ae9..556818d3 100644 --- a/lib/YANLib/YANNum.Float.Nullable.cs +++ b/lib/YANLib/YANNum.Float.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToFloat(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the float representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the float representations of the objects. - public static IEnumerable ToFloat(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToFloat(); - } - } - /// /// Parses the string representation of a float using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToFloat(this IReadOnlyList strs, T? } } - /// - /// Converts an enumerable of strings to an containing the float representations of the strings, using a default value for parsing invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for parsing invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for parsing invalid or null strings. - /// The enumerable of strings to be converted to float. - /// An containing the float representations of the strings. - public static IEnumerable ToFloat(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToFloat(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Float.cs b/lib/YANLib/YANNum.Float.cs index 381076f2..d5e7b386 100644 --- a/lib/YANLib/YANNum.Float.cs +++ b/lib/YANLib/YANNum.Float.cs @@ -109,28 +109,6 @@ public static IEnumerable ToFloat(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the float representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the float representations of the objects. - public static IEnumerable ToFloat(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToFloat(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToFloat(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the float representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted to float. - /// An containing the float representations of the strings. - public static IEnumerable ToFloat(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToFloat(); - } - } - /// /// Parses the string representation of a float using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToFloat(this IReadOnlyList strs, T d } } - /// - /// Converts an enumerable of strings to an containing the float representations of the strings, using a default value for parsing invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for parsing invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for parsing invalid or null strings. - /// The enumerable of strings to be converted to float. - /// An containing the float representations of the strings. - public static IEnumerable ToFloat(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToFloat(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Int.Nullable.cs b/lib/YANLib/YANNum.Int.Nullable.cs index a9535cb7..b61f6e58 100644 --- a/lib/YANLib/YANNum.Int.Nullable.cs +++ b/lib/YANLib/YANNum.Int.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToInt(this IReadOnlyList nums) where T : s } } - /// - /// Converts an enumerable of value-type objects of type to an containing the integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the integer representations of the objects. - public static IEnumerable ToInt(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToInt(); - } - } - /// /// Parses the string representation of an integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToInt(this IReadOnlyList strs, T? dflt } } - /// - /// Converts an enumerable of strings to an containing the integer representations of the strings, using the specified default value for parsing strings that cannot be converted to integers. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for parsing strings that cannot be converted to integers. - /// Must be a value type. - /// - /// The default value to be used for parsing strings that cannot be converted to integers. - /// The enumerable of strings to be converted. - /// An containing the integer representations of the strings. - public static IEnumerable ToInt(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToInt(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Int.cs b/lib/YANLib/YANNum.Int.cs index d0ada37a..0c674313 100644 --- a/lib/YANLib/YANNum.Int.cs +++ b/lib/YANLib/YANNum.Int.cs @@ -109,28 +109,6 @@ public static IEnumerable ToInt(this IReadOnlyList nums) where T : st } } - /// - /// Converts an enumerable of value-type objects of type to an containing the integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the integer representations of the objects. - public static IEnumerable ToInt(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToInt(); - } - } - /// /// Parses the string representation of an integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToInt(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the integer representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the integer representations of the strings. - public static IEnumerable ToInt(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToInt(); - } - } - /// /// Parses the string representation of an integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToInt(this IReadOnlyList strs, T dfltV } } - /// - /// Converts an enumerable of strings to an containing the integer representations of the strings, using the specified default value for parsing strings that cannot be converted to integers. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for parsing strings that cannot be converted to integers. - /// Must be a value type. - /// - /// The default value to be used for parsing strings that cannot be converted to integers. - /// The enumerable of strings to be converted. - /// An containing the integer representations of the strings. - public static IEnumerable ToInt(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToInt(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Long.Nullable.cs b/lib/YANLib/YANNum.Long.Nullable.cs index 42beb528..37026f44 100644 --- a/lib/YANLib/YANNum.Long.Nullable.cs +++ b/lib/YANLib/YANNum.Long.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToLong(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the long integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the long integer representations of the objects. - public static IEnumerable ToLong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToLong(); - } - } - /// /// Parses the string representation of a long using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToLong(this IReadOnlyList strs, T? df } } - /// - /// Converts an enumerable of strings to an containing the long integer representations of the strings, using a default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the long integer representations of the strings. - public static IEnumerable ToLong(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToLong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Long.cs b/lib/YANLib/YANNum.Long.cs index 8a50473d..989687ea 100644 --- a/lib/YANLib/YANNum.Long.cs +++ b/lib/YANLib/YANNum.Long.cs @@ -109,28 +109,6 @@ public static IEnumerable ToLong(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the long integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the long integer representations of the objects. - public static IEnumerable ToLong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToLong(); - } - } - /// /// Parses the string representation of a long using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToLong(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the long integer representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the long integer representations of the strings. - public static IEnumerable ToLong(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToLong(); - } - } - /// /// Parses the string representation of a long using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToLong(this IReadOnlyList strs, T dfl } } - /// - /// Converts an enumerable of strings to an containing the long integer representations of the strings, using a default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the long integer representations of the strings. - public static IEnumerable ToLong(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToLong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Nint.Nullable.cs b/lib/YANLib/YANNum.Nint.Nullable.cs index 1172bf3b..b9c524bf 100644 --- a/lib/YANLib/YANNum.Nint.Nullable.cs +++ b/lib/YANLib/YANNum.Nint.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToNint(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the nint representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the nint representations of the objects. - public static IEnumerable ToNint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNint(); - } - } - /// /// Parses the string representation of a pointer-sized signed integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -245,32 +223,6 @@ public static IEnumerable ToNint(this IReadOnlyList strs, T? df } } - /// - /// Converts an enumerable of strings to an containing the nint representations of the strings, with an optional default value for conversion. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion. - /// Must be a value type. - /// - /// - /// The default value for conversion if a string cannot be parsed to nint. - /// Used when conversion fails for a particular string. - /// - /// The enumerable of strings to be converted. - /// An containing the nint representations of the strings. - public static IEnumerable ToNint(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Nint.cs b/lib/YANLib/YANNum.Nint.cs index d74ebcb6..369ffe62 100644 --- a/lib/YANLib/YANNum.Nint.cs +++ b/lib/YANLib/YANNum.Nint.cs @@ -109,28 +109,6 @@ public static IEnumerable ToNint(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the nint representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the nint representations of the objects. - public static IEnumerable ToNint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNint(); - } - } - /// /// Parses the string representation of a nint using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToNint(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the nint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the nint representations of the strings. - public static IEnumerable ToNint(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNint(); - } - } - /// /// Parses the string representation of a nint using the default format. /// Returns the parsed value, or if the parsing fails. @@ -343,32 +303,6 @@ public static IEnumerable ToNint(this IReadOnlyList strs, T dfl } } - /// - /// Converts an enumerable of strings to an containing the nint representations of the strings, with an optional default value for conversion. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion. - /// Must be a value type. - /// - /// - /// The default value for conversion if a string cannot be parsed to nint. - /// Used when conversion fails for a particular string. - /// - /// The enumerable of strings to be converted. - /// An containing the nint representations of the strings. - public static IEnumerable ToNint(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Nuint.Nullable.cs b/lib/YANLib/YANNum.Nuint.Nullable.cs index 0635342c..60f5d4e9 100644 --- a/lib/YANLib/YANNum.Nuint.Nullable.cs +++ b/lib/YANLib/YANNum.Nuint.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToNuint(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an enumerable of values, which represent the unsigned integer equivalent of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the objects. - public static IEnumerable ToNuint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNuint(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToNuint(this IReadOnlyList strs, T? } } - /// - /// Converts an enumerable of strings to an enumerable of values, which represent the unsigned integer equivalent of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for conversion. - /// Must be a value type. - /// - /// The default value to be used for conversion in case of failure. - /// The enumerable of strings to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the strings. - public static IEnumerable ToNuint(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNuint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Nuint.cs b/lib/YANLib/YANNum.Nuint.cs index 58fa6a81..8e4d9048 100644 --- a/lib/YANLib/YANNum.Nuint.cs +++ b/lib/YANLib/YANNum.Nuint.cs @@ -111,28 +111,6 @@ public static IEnumerable ToNuint(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an enumerable of values, which represent the unsigned integer equivalent of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the objects. - public static IEnumerable ToNuint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToNuint(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -213,24 +191,6 @@ public static IEnumerable ToNuint(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an enumerable of values, which represent the unsigned integer equivalent of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// The enumerable of strings to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the strings. - public static IEnumerable ToNuint(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNuint(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -333,29 +293,6 @@ public static IEnumerable ToNuint(this IReadOnlyList strs, T d } } - /// - /// Converts an enumerable of strings to an enumerable of values, which represent the unsigned integer equivalent of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the default value to be used for conversion. - /// Must be a value type. - /// - /// The default value to be used for conversion in case of failure. - /// The enumerable of strings to be converted. - /// An enumerable of values representing the unsigned integer equivalent of the strings. - public static IEnumerable ToNuint(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToNuint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Sbyte.Nullable.cs b/lib/YANLib/YANNum.Sbyte.Nullable.cs index b2628773..583224db 100644 --- a/lib/YANLib/YANNum.Sbyte.Nullable.cs +++ b/lib/YANLib/YANNum.Sbyte.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToSbyte(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the signed byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the signed byte representations of the objects. - public static IEnumerable ToSbyte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToSbyte(); - } - } - /// /// Parses the string representation of an using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToSbyte(this IReadOnlyList strs, T? } } - /// - /// Converts an enumerable of strings to an containing the signed byte representations of the strings, using the specified default value for invalid string representations. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid string representations. - /// Must be a value type. - /// - /// The default value to be used for invalid string representations. - /// The enumerable of strings to be converted. - /// An containing the signed byte representations of the strings. - public static IEnumerable ToSbyte(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToSbyte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Sbyte.cs b/lib/YANLib/YANNum.Sbyte.cs index c0b49e15..b5ba73b2 100644 --- a/lib/YANLib/YANNum.Sbyte.cs +++ b/lib/YANLib/YANNum.Sbyte.cs @@ -109,28 +109,6 @@ public static IEnumerable ToSbyte(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the signed byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the signed byte representations of the objects. - public static IEnumerable ToSbyte(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToSbyte(); - } - } - /// /// Parses the string representation of a signed byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToSbyte(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the signed byte representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the signed byte representations of the strings. - public static IEnumerable ToSbyte(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToSbyte(); - } - } - /// /// Parses the string representation of a signed byte using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToSbyte(this IReadOnlyList strs, T d } } - /// - /// Converts an enumerable of strings to an containing the signed byte representations of the strings, using the specified default value for invalid string representations. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid string representations. - /// Must be a value type. - /// - /// The default value to be used for invalid string representations. - /// The enumerable of strings to be converted. - /// An containing the signed byte representations of the strings. - public static IEnumerable ToSbyte(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToSbyte(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Short.Nullable.cs b/lib/YANLib/YANNum.Short.Nullable.cs index da13e2d7..7c0cde6a 100644 --- a/lib/YANLib/YANNum.Short.Nullable.cs +++ b/lib/YANLib/YANNum.Short.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToShort(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the short integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the short integer representations of the objects. - public static IEnumerable ToShort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToShort(); - } - } - /// /// Parses the string representation of a short using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToShort(this IReadOnlyList strs, T? } } - /// - /// Converts an enumerable of strings to an containing the short integer representations of the strings, using the specified default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the short integer representations of the strings. - public static IEnumerable ToShort(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToShort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Short.cs b/lib/YANLib/YANNum.Short.cs index 3d3604e4..acba51ec 100644 --- a/lib/YANLib/YANNum.Short.cs +++ b/lib/YANLib/YANNum.Short.cs @@ -109,28 +109,6 @@ public static IEnumerable ToShort(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the short integer representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the short integer representations of the objects. - public static IEnumerable ToShort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToShort(); - } - } - /// /// Parses the string representation of a short integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToShort(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the short integer representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the short integer representations of the strings. - public static IEnumerable ToShort(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToShort(); - } - } - /// /// Parses the string representation of a using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToShort(this IReadOnlyList strs, T d } } - /// - /// Converts an enumerable of strings to an containing the short integer representations of the strings, using the specified default value for invalid or null strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used for invalid or null strings. - /// Must be a value type. - /// - /// The default value to be used for invalid or null strings. - /// The enumerable of strings to be converted. - /// An containing the short integer representations of the strings. - public static IEnumerable ToShort(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToShort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Uint.Nullable.cs b/lib/YANLib/YANNum.Uint.Nullable.cs index 54a11334..80f81a22 100644 --- a/lib/YANLib/YANNum.Uint.Nullable.cs +++ b/lib/YANLib/YANNum.Uint.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToUint(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToUint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUint(); - } - } - /// /// Parses the string representation of an unsigned integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToUint(this IReadOnlyList strs, T? df } } - /// - /// Converts an enumerable of strings to an containing the uint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for the conversion to uint. - /// Must be a value type. - /// - /// The default value for the conversion to uint. - /// The enumerable of strings to be converted. - /// An containing the uint representations of the strings. - public static IEnumerable ToUint(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Uint.cs b/lib/YANLib/YANNum.Uint.cs index 94dc75d7..a17b484f 100644 --- a/lib/YANLib/YANNum.Uint.cs +++ b/lib/YANLib/YANNum.Uint.cs @@ -109,28 +109,6 @@ public static IEnumerable ToUint(this IReadOnlyList nums) where T : } } - /// - /// Converts an enumerable of value-type objects of type to an containing the byte representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the byte representations of the objects. - public static IEnumerable ToUint(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUint(); - } - } - /// /// Parses the string representation of an unsigned integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToUint(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the uint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the uint representations of the strings. - public static IEnumerable ToUint(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUint(); - } - } - /// /// Parses the string representation of an unsigned integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToUint(this IReadOnlyList strs, T dfl } } - /// - /// Converts an enumerable of strings to an containing the uint representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for the conversion to uint. - /// Must be a value type. - /// - /// The default value for the conversion to uint. - /// The enumerable of strings to be converted. - /// An containing the uint representations of the strings. - public static IEnumerable ToUint(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUint(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Ulong.Nullable.cs b/lib/YANLib/YANNum.Ulong.Nullable.cs index b773cb3d..648106ab 100644 --- a/lib/YANLib/YANNum.Ulong.Nullable.cs +++ b/lib/YANLib/YANNum.Ulong.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToUlong(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ulong representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ulong representations of the objects. - public static IEnumerable ToUlong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUlong(); - } - } - /// /// Parses the string representation of an unsigned long integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToUlong(this IReadOnlyList strs, T? } } - /// - /// Converts an enumerable of strings to an containing the ulong representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used when converting strings to ulong. - /// Must be a value type. - /// - /// The default value to be used when converting strings to ulong. - /// The enumerable of strings to be converted. - /// An containing the ulong representations of the strings. - public static IEnumerable ToUlong(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUlong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Ulong.cs b/lib/YANLib/YANNum.Ulong.cs index 06a85812..99c00371 100644 --- a/lib/YANLib/YANNum.Ulong.cs +++ b/lib/YANLib/YANNum.Ulong.cs @@ -111,28 +111,6 @@ public static IEnumerable ToUlong(this IReadOnlyList nums) where T } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ulong representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ulong representations of the objects. - public static IEnumerable ToUlong(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUlong(); - } - } - /// /// Parses the string representation of an unsigned long integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -213,24 +191,6 @@ public static IEnumerable ToUlong(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the ulong representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the ulong representations of the strings. - public static IEnumerable ToUlong(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUlong(); - } - } - /// /// Parses the string representation of an using the default format. /// Returns the parsed value, or if the parsing fails. @@ -333,29 +293,6 @@ public static IEnumerable ToUlong(this IReadOnlyList strs, T d } } - /// - /// Converts an enumerable of strings to an containing the ulong representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value to be used when converting strings to ulong. - /// Must be a value type. - /// - /// The default value to be used when converting strings to ulong. - /// The enumerable of strings to be converted. - /// An containing the ulong representations of the strings. - public static IEnumerable ToUlong(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUlong(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Ushort.Nullable.cs b/lib/YANLib/YANNum.Ushort.Nullable.cs index 8b37504b..19da573c 100644 --- a/lib/YANLib/YANNum.Ushort.Nullable.cs +++ b/lib/YANLib/YANNum.Ushort.Nullable.cs @@ -109,28 +109,6 @@ public static IEnumerable ToUshort(this IReadOnlyList nums) where } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ushort representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ushort representations of the objects. - public static IEnumerable ToUshort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUshort(); - } - } - /// /// Parses the string representation of a ushort using the default format. /// Returns the parsed value, or if the parsing fails. @@ -233,29 +211,6 @@ public static IEnumerable ToUshort(this IReadOnlyList strs, T } } - /// - /// Converts an enumerable of strings to an containing the ushort representations of the strings, using the specified default value for conversion failure. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failure. - /// Must be a value type. - /// - /// The default value to be used for conversion failure. - /// The enumerable of strings to be converted. - /// An containing the ushort representations of the strings. - public static IEnumerable ToUshort(this IReadOnlySet strs, T? dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUshort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.Ushort.cs b/lib/YANLib/YANNum.Ushort.cs index 8601a831..00c6dba4 100644 --- a/lib/YANLib/YANNum.Ushort.cs +++ b/lib/YANLib/YANNum.Ushort.cs @@ -109,28 +109,6 @@ public static IEnumerable ToUshort(this IReadOnlyList nums) where } } - /// - /// Converts an enumerable of value-type objects of type to an containing the ushort representations of the objects. - /// Returns an empty sequence if the input enumerable is , empty, or contains only objects. - /// - /// - /// The type of the value-type objects to be converted. - /// Must be a value type. - /// - /// The enumerable of value-type objects to be converted. - /// An containing the ushort representations of the objects. - public static IEnumerable ToUshort(this IReadOnlySet nums) where T : struct - { - if (nums is null || nums.Count < 1) - { - yield break; - } - foreach (var num in nums) - { - yield return num.ToUshort(); - } - } - /// /// Parses the string representation of an unsigned short integer using the default format. /// Returns the parsed value, or if the parsing fails. @@ -211,24 +189,6 @@ public static IEnumerable ToUshort(this IReadOnlyList strs) } } - /// - /// Converts an enumerable of strings to an containing the ushort representations of the strings. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// The enumerable of strings to be converted. - /// An containing the ushort representations of the strings. - public static IEnumerable ToUshort(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUshort(); - } - } - /// /// Parses the string representation of an unsigned short using the default format. /// Returns the parsed value, or if the parsing fails. @@ -331,29 +291,6 @@ public static IEnumerable ToUshort(this IReadOnlyList strs, T } } - /// - /// Converts an enumerable of strings to an containing the ushort representations of the strings, using the specified default value for conversion failure. - /// Returns an empty sequence if the input enumerable is , empty, or contains only strings. - /// - /// - /// The type of the default value for conversion failure. - /// Must be a value type. - /// - /// The default value to be used for conversion failure. - /// The enumerable of strings to be converted. - /// An containing the ushort representations of the strings. - public static IEnumerable ToUshort(this IReadOnlySet strs, T dfltVal) where T : struct - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var num in strs) - { - yield return num.ToUshort(dfltVal); - } - } - /// /// Generates a random value between and . /// If is greater than , is returned. diff --git a/lib/YANLib/YANNum.cs b/lib/YANLib/YANNum.cs index 24b3ecbc..45362bfa 100644 --- a/lib/YANLib/YANNum.cs +++ b/lib/YANLib/YANNum.cs @@ -17,7 +17,7 @@ public static partial class YANNum var min = nums[0]; for (var i = 1; i < nums?.Length; i++) { - if (nums[i]?.CompareTo(min) < 0) + if (nums[i] is not null && nums[i].CompareTo(min) < 0) { min = nums[i]; } @@ -25,6 +25,8 @@ public static partial class YANNum return min; } + public static T? Min(IEnumerable nums) where T : IComparable => nums is null || !nums.Any() ? default : nums.Where(x => x is not null).DefaultIfEmpty(default).Min(); + /// /// Finds the maximum value in an array of values that implement the interface. /// @@ -47,4 +49,6 @@ public static partial class YANNum } return max; } + + public static T? Max(IEnumerable nums) where T : IComparable => nums is null || !nums.Any() ? default : nums.Where(x => x is not null).DefaultIfEmpty(default).Max(); } diff --git a/lib/YANLib/YANPass.cs b/lib/YANLib/YANPass.cs index b60f76d8..6a3c1e7d 100644 --- a/lib/YANLib/YANPass.cs +++ b/lib/YANLib/YANPass.cs @@ -170,30 +170,6 @@ public bool IsValidPassword(string password, IReadOnlyList splChars) return IsMatch(password, $@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[{Escape(new string(newPwdSplChar.ToArray()))}]).+$"); } - /// - /// Determines whether a password meets the standard requirements for password validation, which are: it contains at least one character, has a length of at least 8, and contains at least one lowercase letter, one uppercase letter, one digit, and one special character, in addition to any specified additional special characters. - /// - /// The password string to validate. - /// Additional special characters to require in the password. - /// if the password meets the standard requirements for password validation; otherwise, . - public bool IsValidPassword(string password, IReadOnlySet splChars) - { - // has character - if (!password.IsNotNullAndWhiteSpace()) - { - return false; - } - // has 8 characters - if (password.Length < 8) - { - return false; - } - // Check if the password matches the regex pattern - var newPwdSplChar = new HashSet(PASSWORD_SPECIAL_CHARATERS_STANDARD); - newPwdSplChar.UnionWith(splChars); - return IsMatch(password, $@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[{Escape(new string(newPwdSplChar.ToArray()))}]).+$"); - } - /// /// Determines whether a password meets the requirements for password validation, which are: it contains at least one character, has a length of at least the specified value, and contains at least one lowercase letter, one uppercase letter, one digit, and one special character, in addition to any specified additional special characters. /// @@ -293,30 +269,5 @@ public bool IsValidPassword(string password, T len, IReadOnlyList splCh newPwdSplChar.UnionWith(splChars); return IsMatch(password, $@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[{Escape(new string(newPwdSplChar.ToArray()))}]).+$"); } - - /// - /// Determines whether a password meets the requirements for password validation, which are: it contains at least one character, has a length of at least the specified value, and contains at least one lowercase letter, one uppercase letter, one digit, and one special character, in addition to any specified additional special characters. - /// - /// The password string to validate. - /// The minimum length for the password. - /// Additional special characters to require in the password. - /// if the password meets the requirements for password validation; otherwise, . - public bool IsValidPassword(string password, T len, IReadOnlySet splChars) where T : struct - { - // has character - if (!password.IsNotNullAndWhiteSpace()) - { - return false; - } - // has len character - if (password.Length < len.ToByte()) - { - return false; - } - // Check if the password matches the regex pattern - var newPwdSplChar = new HashSet(PASSWORD_SPECIAL_CHARATERS_STANDARD); - newPwdSplChar.UnionWith(splChars); - return IsMatch(password, $@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[{Escape(new string(newPwdSplChar.ToArray()))}]).+$"); - } #endregion } diff --git a/lib/YANLib/YANRandom.cs b/lib/YANLib/YANRandom.cs index 9d50f147..9249d4bd 100644 --- a/lib/YANLib/YANRandom.cs +++ b/lib/YANLib/YANRandom.cs @@ -14,7 +14,7 @@ public static partial class YANRandom /// /// The object. /// A random value. - public static decimal NextDecimal(this Random rnd) => new(rnd.NextInt32(), rnd.NextInt32(), rnd.NextInt32(), rnd.Next(2) == 1, (byte)rnd.Next(29)); + public static decimal NextDecimal(this Random rnd) => new(rnd.NextInt32(), rnd.NextInt32(), rnd.NextInt32(), rnd.Next(2) is 1, (byte)rnd.Next(29)); /// /// Returns a random value between and . diff --git a/lib/YANLib/YANTask.cs b/lib/YANLib/YANTask.cs index f954113d..7653cb17 100644 --- a/lib/YANLib/YANTask.cs +++ b/lib/YANLib/YANTask.cs @@ -86,29 +86,6 @@ public static partial class YANTask return default; } - /// - /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. - /// - /// The type of the value to be returned, which must be a value type. - /// The value that the result of the completed task should match in order to be considered valid. - /// An enumerable of objects to wait for. - /// - /// A that represents the asynchronous operation. - /// The result of the operation is the value of the completed task that matches the specified condition, or if no such task completed successfully. - /// - public static async ValueTask WaitAnyWithCondition(this IReadOnlySet> tasks, T goodRslt) where T : IComparable - { - if (tasks is not null && tasks.Count > 0) - { - var cmplTask = await WhenAny(tasks.Select(t => t.AsTask()).ToList()).ConfigureAwait(false); - if (cmplTask.IsCompletedSuccessfully && typeof(T).IsValueType && cmplTask.Result.Equals(goodRslt)) - { - return cmplTask.Result; - } - } - return default; - } - /// /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. /// @@ -181,26 +158,6 @@ public static partial class YANTask return default; } - /// - /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. - /// - /// The type of the value to be returned, which must be a value type. - /// The value that the result of the completed task should match in order to be considered valid. - /// An enumerable of objects to wait for. - /// - /// A that represents the asynchronous operation. - /// The result of the operation is the value of the completed task that matches the specified condition, or if no such task completed successfully. - /// - public static async ValueTask WaitAnyWithCondition(this IReadOnlySet> tasks, T goodRslt) where T : IComparable - { - if (tasks is not null && tasks.Count > 0) - { - var valueTasks = tasks.Select(t => new ValueTask(t)); - return await valueTasks.WaitAnyWithCondition(goodRslt); - } - return default; - } - /// /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. /// @@ -300,35 +257,6 @@ public static partial class YANTask return default; } - /// - /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. - /// - /// The type of the value to be returned, which must be a value type. - /// The value that the result of the completed task should match in order to be considered valid. - /// An enumerable of objects to wait for. - /// - /// A that represents the asynchronous operation. - /// The result of the operation is the value of the completed task that matches the specified condition, or if no such task completed successfully. - /// - public static async ValueTask WhenAnyWithCondition(this IReadOnlySet> tasks, T goodRslt) where T : IComparable - { - if (tasks is not null && tasks.Count > 0) - { - var taskSet = tasks.Select(t => t.AsTask()).ToHashSet(); - while (taskSet.Count > 0) - { - var cmplTask = await WhenAny(taskSet).ConfigureAwait(false); - _ = taskSet.Remove(cmplTask); - var rslt = await cmplTask.ConfigureAwait(false); - if (typeof(T).IsValueType && rslt.Equals(goodRslt)) - { - return rslt; - } - } - } - return default; - } - /// /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. /// @@ -400,24 +328,4 @@ public static partial class YANTask } return default; } - - /// - /// Waits for any of the specified objects in an enumerable of to complete and returns a nullable result that matches the specified condition. - /// - /// The type of the value to be returned, which must be a value type. - /// The value that the result of the completed task should match in order to be considered valid. - /// An enumerable of objects to wait for. - /// - /// A that represents the asynchronous operation. - /// The result of the operation is the value of the completed task that matches the specified condition, or if no such task completed successfully. - /// - public static async ValueTask WhenAnyWithCondition(this IReadOnlySet> tasks, T goodRslt) where T : IComparable - { - if (tasks is not null && tasks.Count > 0) - { - var valueTasks = tasks.Select(t => new ValueTask(t)); - return await valueTasks.WhenAnyWithCondition(goodRslt); - } - return default; - } } diff --git a/lib/YANLib/YANText.Char.cs b/lib/YANLib/YANText.Char.cs index 0fd98d49..b694a0e5 100644 --- a/lib/YANLib/YANText.Char.cs +++ b/lib/YANLib/YANText.Char.cs @@ -9,7 +9,7 @@ public static partial class YANText /// /// The character to check. /// if the character is the null character (); otherwise, . - public static bool IsEmpty(this char c) => c == char.MinValue; + public static bool IsEmpty(this char c) => c is char.MinValue; /// /// Determines whether any of the specified characters in the enumerable is or . @@ -25,27 +25,6 @@ public static partial class YANText /// if any of the characters in the enumerable is or ; otherwise, . public static bool IsEmpty(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNotEmpty()); - /// - /// Determines whether any of the specified characters in the enumerable is or . - /// - /// The characters to check. - /// if any of the characters in the enumerable is or ; otherwise, . - public static bool IsEmpty(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNotEmpty()); - - /// - /// Determines whether any of the specified characters in the enumerable is or . - /// - /// The characters to check. - /// if any of the characters in the enumerable is or ; otherwise, . - public static bool IsEmpty(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNotEmpty()); - - /// - /// Determines whether any of the specified characters in the enumerable is or . - /// - /// The characters to check. - /// if any of the characters in the enumerable is or ; otherwise, . - public static bool IsEmpty(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNotEmpty()); - /// /// Determines whether the specified character is a white space character, including space, tab, and line break characters. /// @@ -67,27 +46,6 @@ public static partial class YANText /// if any of the characters in the enumerable is a white space character; otherwise, . public static bool IsWhiteSpace(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNotWhiteSpace()); - /// - /// Determines whether any of the specified characters in the enumerable is a white space character, including space, tab, and line break characters. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a white space character; otherwise, . - public static bool IsWhiteSpace(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNotWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is a white space character, including space, tab, and line break characters. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a white space character; otherwise, . - public static bool IsWhiteSpace(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNotWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is a white space character, including space, tab, and line break characters. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a white space character; otherwise, . - public static bool IsWhiteSpace(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNotWhiteSpace()); - /// /// Determines whether the specified character is the null character () or white space. /// @@ -109,27 +67,6 @@ public static partial class YANText /// if any of the characters in the enumerable is or or whitespace; otherwise, . public static bool IsNullOrWhiteSpace(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNotEmptyAndWhiteSpace()); - /// - /// Determines whether any of the specified characters in the enumerable is or or whitespace. - /// - /// The characters to check. - /// if any of the characters in the enumerable is or or whitespace; otherwise, . - public static bool IsNullOrWhiteSpace(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNotEmptyAndWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is or or whitespace. - /// - /// The characters to check. - /// if any of the characters in the enumerable is or or whitespace; otherwise, . - public static bool IsNullOrWhiteSpace(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNotEmptyAndWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is or or whitespace. - /// - /// The characters to check. - /// if any of the characters in the enumerable is or or whitespace; otherwise, . - public static bool IsNullOrWhiteSpace(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNotEmptyAndWhiteSpace()); - /// /// Determines whether the specified character is an alphabetic character, which includes letters from any language, or is the null character () or a white space character. /// @@ -151,27 +88,6 @@ public static partial class YANText /// if any of the characters in the enumerable is an alphabetic character, or is , or is the null character (), or is a white space character; otherwise, . public static bool IsAlphabetic(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNotAlphabetic()); - /// - /// Determines whether any of the specified characters in the enumerable is an alphabetic character, which includes letters from any language, or is , or is the null character (), or is a white space character. - /// - /// The characters to check. - /// if any of the characters in the enumerable is an alphabetic character, or is , or is the null character (), or is a white space character; otherwise, . - public static bool IsAlphabetic(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNotAlphabetic()); - - /// - /// Determines whether any of the specified characters in the enumerable is an alphabetic character, which includes letters from any language, or is , or is the null character (), or is a white space character. - /// - /// The characters to check. - /// if any of the characters in the enumerable is an alphabetic character, or is , or is the null character (), or is a white space character; otherwise, . - public static bool IsAlphabetic(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNotAlphabetic()); - - /// - /// Determines whether any of the specified characters in the enumerable is an alphabetic character, which includes letters from any language, or is , or is the null character (), or is a white space character. - /// - /// The characters to check. - /// if any of the characters in the enumerable is an alphabetic character, or is , or is the null character (), or is a white space character; otherwise, . - public static bool IsAlphabetic(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNotAlphabetic()); - /// /// Determines whether the specified character is a punctuation character, such as period, comma, exclamation mark, etc., or is the null character () or a white space character. /// @@ -193,27 +109,6 @@ public static partial class YANText /// if any of the characters in the enumerable is a punctuation character, or is or or whitespace; otherwise, . public static bool IsPunctuation(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNotPunctuation()); - /// - /// Determines whether any of the specified characters in the enumerable is a punctuation character, such as period, comma, exclamation mark, etc., or is or or whitespace. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a punctuation character, or is or or whitespace; otherwise, . - public static bool IsPunctuation(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNotPunctuation()); - - /// - /// Determines whether any of the specified characters in the enumerable is a punctuation character, such as period, comma, exclamation mark, etc., or is or or whitespace. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a punctuation character, or is or or whitespace; otherwise, . - public static bool IsPunctuation(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNotPunctuation()); - - /// - /// Determines whether any of the specified characters in the enumerable is a punctuation character, such as period, comma, exclamation mark, etc., or is or or whitespace. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a punctuation character, or is or or whitespace; otherwise, . - public static bool IsPunctuation(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNotPunctuation()); - /// /// Determines whether the specified character is a numeric character, such as 0-9, or is the null character () or a punctuation character, such as period, comma, exclamation mark, etc. /// @@ -235,27 +130,6 @@ public static partial class YANText /// if any of the characters in the enumerable is a numeric character, or is or or whitespace, or is a punctuation character; otherwise, . public static bool IsNumber(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNotNumber()); - /// - /// Determines whether any of the specified characters in the enumerable is a numeric character, such as 0-9, or is or or whitespace, or is a punctuation character, such as period, comma, exclamation mark, etc. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a numeric character, or is or or whitespace, or is a punctuation character; otherwise, . - public static bool IsNumber(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNotNumber()); - - /// - /// Determines whether any of the specified characters in the enumerable is a numeric character, such as 0-9, or is or or whitespace, or is a punctuation character, such as period, comma, exclamation mark, etc. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a numeric character, or is or or whitespace, or is a punctuation character; otherwise, . - public static bool IsNumber(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNotNumber()); - - /// - /// Determines whether any of the specified characters in the enumerable is a numeric character, such as 0-9, or is or or whitespace, or is a punctuation character, such as period, comma, exclamation mark, etc. - /// - /// The characters to check. - /// if any of the characters in the enumerable is a numeric character, or is or or whitespace, or is a punctuation character; otherwise, . - public static bool IsNumber(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNotNumber()); - /// /// Determines whether the specified characters are equal, comparing their Unicode values. /// @@ -278,27 +152,6 @@ public static partial class YANText /// if any of the characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values; otherwise, . public static bool Equals(this IEnumerable cs) => cs is not null && !cs.Any(s => s.NotEquals(cs.First())); - /// - /// Determines whether any of the specified characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values. - /// - /// The characters to compare. - /// if any of the characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values; otherwise, . - public static bool Equals(this IReadOnlyCollection cs) => cs is not null && !cs.Any(s => s.NotEquals(cs.First())); - - /// - /// Determines whether any of the specified characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values. - /// - /// The characters to compare. - /// if any of the characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values; otherwise, . - public static bool Equals(this IReadOnlyList cs) => cs is not null && !cs.Any(s => s.NotEquals(cs[0])); - - /// - /// Determines whether any of the specified characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values. - /// - /// The characters to compare. - /// if any of the characters in the enumerable are equal to the first character in the enumerable, comparing their Unicode values; otherwise, . - public static bool Equals(this IReadOnlySet cs) => cs is not null && !cs.Any(s => s.NotEquals(cs.First())); - /// /// Determines whether the specified characters are equal, ignoring their casing, and comparing their Unicode values. /// @@ -321,27 +174,6 @@ public static partial class YANText /// if any of the characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values; otherwise, . public static bool EqualsIgnoreCase(this IEnumerable cs) => cs is not null && !cs.Any(s => s.NotEqualsIgnoreCase(cs.First())); - /// - /// Determines whether any of the specified characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values. - /// - /// The characters to compare. - /// if any of the characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values; otherwise, . - public static bool EqualsIgnoreCase(this IReadOnlyCollection cs) => cs is not null && !cs.Any(s => s.NotEqualsIgnoreCase(cs.First())); - - /// - /// Determines whether any of the specified characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values. - /// - /// The characters to compare. - /// if any of the characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values; otherwise, . - public static bool EqualsIgnoreCase(this IReadOnlyList cs) => cs is not null && !cs.Any(s => s.NotEqualsIgnoreCase(cs[0])); - - /// - /// Determines whether any of the specified characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values. - /// - /// The characters to compare. - /// if any of the characters in the enumerable are equal to the first character in the enumerable, ignoring their casing, and comparing their Unicode values; otherwise, . - public static bool EqualsIgnoreCase(this IReadOnlySet cs) => cs is not null && !cs.Any(s => s.NotEqualsIgnoreCase(cs.First())); - /// /// Determines whether the specified character is not the null character (). /// @@ -363,27 +195,6 @@ public static partial class YANText /// if any of the characters in the enumerable is not and not ; otherwise, . public static bool IsNotEmpty(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsEmpty()); - /// - /// Determines whether any of the specified characters in the enumerable is not and not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not and not ; otherwise, . - public static bool IsNotEmpty(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsEmpty()); - - /// - /// Determines whether any of the specified characters in the enumerable is not and not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not and not ; otherwise, . - public static bool IsNotEmpty(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsEmpty()); - - /// - /// Determines whether any of the specified characters in the enumerable is not and not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not and not ; otherwise, . - public static bool IsNotEmpty(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsEmpty()); - /// /// Determines whether the specified character is not a whitespace character, including space, tab, newline, carriage return, form feed, or vertical tab. /// @@ -405,27 +216,6 @@ public static partial class YANText /// if any of the characters in the enumerable is not a whitespace character; otherwise, . public static bool IsNotWhiteSpace(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsWhiteSpace()); - /// - /// Determines whether any of the specified characters in the enumerable is not a whitespace character, including space, tab, newline, carriage return, form feed, or vertical tab. - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a whitespace character; otherwise, . - public static bool IsNotWhiteSpace(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a whitespace character, including space, tab, newline, carriage return, form feed, or vertical tab. - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a whitespace character; otherwise, . - public static bool IsNotWhiteSpace(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a whitespace character, including space, tab, newline, carriage return, form feed, or vertical tab. - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a whitespace character; otherwise, . - public static bool IsNotWhiteSpace(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsWhiteSpace()); - /// /// Determines whether the specified character is not the null character () and is not a whitespace character. /// @@ -447,27 +237,6 @@ public static partial class YANText /// if any of the characters in the enumerable is not a white-space character or ; otherwise, . public static bool IsNotEmptyAndWhiteSpace(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNullOrWhiteSpace()); - /// - /// Determines whether any of the specified characters in the enumerable is not a white-space character or . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a white-space character or ; otherwise, . - public static bool IsNotEmptyAndWhiteSpace(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNullOrWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a white-space character or . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a white-space character or ; otherwise, . - public static bool IsNotEmptyAndWhiteSpace(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNullOrWhiteSpace()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a white-space character or . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a white-space character or ; otherwise, . - public static bool IsNotEmptyAndWhiteSpace(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNullOrWhiteSpace()); - /// /// Determines whether the specified character is not an alphabetic character and is not the null character () and is not a whitespace character. /// @@ -489,27 +258,6 @@ public static partial class YANText /// if any of the characters in the enumerable is not an alphabetic character, not a white-space character, or not ; otherwise, . public static bool IsNotAlphabetic(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsAlphabetic()); - /// - /// Determines whether any of the specified characters in the enumerable is not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotAlphabetic(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsAlphabetic()); - - /// - /// Determines whether any of the specified characters in the enumerable is not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotAlphabetic(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsAlphabetic()); - - /// - /// Determines whether any of the specified characters in the enumerable is not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotAlphabetic(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsAlphabetic()); - /// /// Determines whether the specified character is not a punctuation character, not an alphabetic character, not the null character (), and not a whitespace character. /// @@ -531,27 +279,6 @@ public static partial class YANText /// if any of the characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . public static bool IsNotPunctuation(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsPunctuation()); - /// - /// Determines whether any of the specified characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotPunctuation(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsPunctuation()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotPunctuation(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsPunctuation()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotPunctuation(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsPunctuation()); - /// /// Determines whether the specified character is not a numeric character, not a punctuation character, not an alphabetic character, not the null character (), and not a whitespace character. /// @@ -573,27 +300,6 @@ public static partial class YANText /// if any of the characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . public static bool IsNotNumber(this IEnumerable cs) => cs is not null && !cs.Any(c => c.IsNumber()); - /// - /// Determines whether any of the specified characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotNumber(this IReadOnlyCollection cs) => cs is not null && !cs.Any(c => c.IsNumber()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotNumber(this IReadOnlyList cs) => cs is not null && !cs.Any(c => c.IsNumber()); - - /// - /// Determines whether any of the specified characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not . - /// - /// The characters to check. - /// if any of the characters in the enumerable is not a numeric character, not a punctuation character, not an alphabetic character, not a white-space character, or not ; otherwise, . - public static bool IsNotNumber(this IReadOnlySet cs) => cs is not null && !cs.Any(c => c.IsNumber()); - /// /// Determines whether two specified characters are not equal, based on their Unicode values. /// @@ -690,28 +396,6 @@ public static bool NotEquals(this IReadOnlyList cs) return true; } - /// - /// Determines whether all the characters in the specified enumerable are distinct, based on their Unicode values. - /// - /// The characters to check. - /// if all the characters in the specified enumerable are distinct, based on their Unicode values; otherwise, . - public static bool NotEquals(this IReadOnlySet cs) - { - if (cs is null || cs.Count < 2) - { - return false; - } - var hashSet = new HashSet(cs.Count); - foreach (var c in cs) - { - if (!hashSet.Add(c)) - { - return false; - } - } - return true; - } - /// /// Determines whether two specified characters are not equal, ignoring their casing, based on their Unicode values. /// @@ -808,28 +492,6 @@ public static bool NotEqualsIgnoreCase(this IReadOnlyList cs) return true; } - /// - /// Determines whether all the characters in the specified enumerable are distinct, ignoring their casing, based on their Unicode values. - /// - /// The characters to check. - /// if all the characters in the specified enumerable are distinct, ignoring their casing, based on their Unicode values; otherwise, . - public static bool NotEqualsIgnoreCase(this IReadOnlySet cs) - { - if (cs is null || cs.Count < 2) - { - return false; - } - var hashSet = new HashSet(cs.Count); - foreach (var c in cs) - { - if (!hashSet.Add(c.ToLowerInvariant())) - { - return false; - } - } - return true; - } - /// /// Returns the non-null character value or if it is or empty. /// @@ -930,23 +592,6 @@ public static IEnumerable ToLower(this IReadOnlyList cs) } } - /// - /// Enumerates through an enumerable of characters and returns a new enumerable of characters converted to lowercase, ignoring their casing, based on their Unicode values. - /// - /// The characters to convert to lowercase. - /// An enumerable of characters converted to lowercase, ignoring their casing, based on their Unicode values. - public static IEnumerable ToLower(this IReadOnlySet cs) - { - if (cs is null || cs.Count < 1) - { - yield break; - } - foreach (var c in cs) - { - yield return ToLower(c); - } - } - /// /// Converts the characters in the specified list to lowercase, ignoring their casing, based on their Unicode values. /// @@ -1037,23 +682,6 @@ public static IEnumerable ToLowerInvariant(this IReadOnlyList cs) } } - /// - /// Enumerates through an enumerable of characters and returns a new enumerable of characters converted to lowercase, ignoring their casing, based on their Unicode values using the invariant culture. - /// - /// The characters to convert to lowercase. - /// An enumerable of characters converted to lowercase, ignoring their casing, based on their Unicode values using the invariant culture. - public static IEnumerable ToLowerInvariant(this IReadOnlySet cs) - { - if (cs is null || cs.Count < 1) - { - yield break; - } - foreach (var c in cs) - { - yield return ToLowerInvariant(c); - } - } - /// /// Converts all characters in the specified character list to lowercase using the invariant culture, by modifying the list in-place. /// @@ -1144,23 +772,6 @@ public static IEnumerable ToUpper(this IReadOnlyList cs) } } - /// - /// Enumerates through an enumerable of characters and returns a new enumerable of characters converted to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - /// - /// The characters to convert to uppercase. - /// An enumerable of characters converted to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - public static IEnumerable ToUpper(this IReadOnlySet cs) - { - if (cs is null || cs.Count < 1) - { - yield break; - } - foreach (var c in cs) - { - yield return ToUpper(c); - } - } - /// /// Converts all characters in the specified character list to uppercase, by modifying the list in-place. /// @@ -1251,23 +862,6 @@ public static IEnumerable ToUpperInvariant(this IReadOnlyList cs) } } - /// - /// Enumerates through an enumerable of characters and returns a new enumerable of characters converted to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - /// - /// The characters to convert to uppercase. - /// An enumerable of characters converted to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - public static IEnumerable ToUpperInvariant(this IReadOnlySet cs) - { - if (cs is null || cs.Count < 1) - { - yield break; - } - foreach (var c in cs) - { - yield return ToUpperInvariant(c); - } - } - /// /// Converts all characters in the specified character list to uppercase using the invariant culture, by modifying the list in-place. /// diff --git a/lib/YANLib/YANText.String.cs b/lib/YANLib/YANText.String.cs index c8a2bc3d..f1f6df8c 100644 --- a/lib/YANLib/YANText.String.cs +++ b/lib/YANLib/YANText.String.cs @@ -26,27 +26,6 @@ public static partial class YANText /// if any of the strings in the enumerable is ; otherwise, . public static bool IsNull(this IEnumerable strs) => strs is not null && !strs.Any(s => s.IsNotNull()); - /// - /// Determines whether any of the specified strings in the enumerable is . - /// - /// The strings to check. - /// if any of the strings in the enumerable is ; otherwise, . - public static bool IsNull(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.IsNotNull()); - - /// - /// Determines whether any of the specified strings in the enumerable is . - /// - /// The strings to check. - /// if any of the strings in the enumerable is ; otherwise, . - public static bool IsNull(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.IsNotNull()); - - /// - /// Determines whether any of the specified strings in the enumerable is . - /// - /// The strings to check. - /// if any of the strings in the enumerable is ; otherwise, . - public static bool IsNull(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.IsNotNull()); - /// /// Determines whether the specified string is or . /// @@ -68,27 +47,6 @@ public static partial class YANText /// if any of the strings in the enumerable is or ; otherwise, . public static bool IsNullOrEmpty(this IEnumerable strs) => strs is not null && !strs.Any(s => s.IsNotNullAndEmpty()); - /// - /// Determines whether any of the specified strings in the enumerable is or . - /// - /// The strings to check. - /// if any of the strings in the enumerable is or ; otherwise, . - public static bool IsNullOrEmpty(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.IsNotNullAndEmpty()); - - /// - /// Determines whether any of the specified strings in the enumerable is or . - /// - /// The strings to check. - /// if any of the strings in the enumerable is or ; otherwise, . - public static bool IsNullOrEmpty(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.IsNotNullAndEmpty()); - - /// - /// Determines whether any of the specified strings in the enumerable is or . - /// - /// The strings to check. - /// if any of the strings in the enumerable is or ; otherwise, . - public static bool IsNullOrEmpty(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.IsNotNullAndEmpty()); - /// /// Determines whether the specified string is , , or consists only of white-space characters. /// @@ -110,27 +68,6 @@ public static partial class YANText /// if any of the strings in the enumerable is , , or consists only of white-space characters; otherwise, . public static bool IsNullOrWhiteSpace(this IEnumerable strs) => strs is not null && !strs.Any(s => s.IsNotNullAndWhiteSpace()); - /// - /// Determines whether any of the specified strings in the enumerable is , , or consists only of white-space characters. - /// - /// The strings to check. - /// if any of the strings in the enumerable is , , or consists only of white-space characters; otherwise, . - public static bool IsNullOrWhiteSpace(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.IsNotNullAndWhiteSpace()); - - /// - /// Determines whether any of the specified strings in the enumerable is , , or consists only of white-space characters. - /// - /// The strings to check. - /// if any of the strings in the enumerable is , , or consists only of white-space characters; otherwise, . - public static bool IsNullOrWhiteSpace(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.IsNotNullAndWhiteSpace()); - - /// - /// Determines whether any of the specified strings in the enumerable is , , or consists only of white-space characters. - /// - /// The strings to check. - /// if any of the strings in the enumerable is , , or consists only of white-space characters; otherwise, . - public static bool IsNullOrWhiteSpace(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.IsNotNullAndWhiteSpace()); - /// /// Determines whether the specified strings are equal, comparing their values. /// @@ -153,27 +90,6 @@ public static partial class YANText /// if any of the strings in the enumerable are equal to the first string in the enumerable, comparing their values; otherwise, . public static bool Equals(this IEnumerable strs) => strs is not null && !strs.Any(s => s.NotEquals(strs.First())); - /// - /// Determines whether any of the specified strings in the enumerable are equal to the first string in the enumerable, comparing their values. - /// - /// The strings to compare. - /// if any of the strings in the enumerable are equal to the first string in the enumerable, comparing their values; otherwise, . - public static bool Equals(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.NotEquals(strs.First())); - - /// - /// Determines whether any of the specified strings in the enumerable are equal to the first string in the enumerable, comparing their values. - /// - /// The strings to compare. - /// if any of the strings in the enumerable are equal to the first string in the enumerable, comparing their values; otherwise, . - public static bool Equals(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.NotEquals(strs[0])); - - /// - /// Determines whether any of the specified strings in the enumerable are equal to the first string in the enumerable, comparing their values. - /// - /// The strings to compare. - /// if any of the strings in the enumerable are equal to the first string in the enumerable, comparing their values; otherwise, . - public static bool Equals(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.NotEquals(strs.First())); - /// /// Determines whether the specified strings are equal, ignoring their casing, and comparing their values using ordinal comparison. /// @@ -196,27 +112,6 @@ public static partial class YANText /// if any of the strings in the enumerable are equal to the first string in the enumerable, ignoring their casing, and comparing their values using ordinal comparison; otherwise, . public static bool EqualsIgnoreCase(this IEnumerable strs) => strs is not null && !strs.Any(s => s.NotEqualsIgnoreCase(strs.First())); - /// - /// Determines whether the specified strings are equal, ignoring their casing, and comparing their values using ordinal comparison. - /// - /// The strings to compare. - /// if any of the strings in the enumerable are equal to the first string in the enumerable, ignoring their casing, and comparing their values using ordinal comparison; otherwise, . - public static bool EqualsIgnoreCase(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.NotEqualsIgnoreCase(strs.First())); - - /// - /// Determines whether the specified strings are equal, ignoring their casing, and comparing their values using ordinal comparison. - /// - /// The strings to compare. - /// if any of the strings in the enumerable are equal to the first string in the enumerable, ignoring their casing, and comparing their values using ordinal comparison; otherwise, . - public static bool EqualsIgnoreCase(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.NotEqualsIgnoreCase(strs[0])); - - /// - /// Determines whether the specified strings are equal, ignoring their casing, and comparing their values using ordinal comparison. - /// - /// The strings to compare. - /// if any of the strings in the enumerable are equal to the first string in the enumerable, ignoring their casing, and comparing their values using ordinal comparison; otherwise, . - public static bool EqualsIgnoreCase(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.NotEqualsIgnoreCase(strs.First())); - /// /// Determines whether the specified string is not . /// @@ -238,27 +133,6 @@ public static partial class YANText /// if all the strings in the enumerable are not ; otherwise, . public static bool IsNotNull(this IEnumerable strs) => strs is not null && !strs.Any(s => s.IsNull()); - /// - /// Determines whether the specified strings are not . - /// - /// The strings to check. - /// if all the strings in the enumerable are not ; otherwise, . - public static bool IsNotNull(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.IsNull()); - - /// - /// Determines whether the specified strings are not . - /// - /// The strings to check. - /// if all the strings in the enumerable are not ; otherwise, . - public static bool IsNotNull(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.IsNull()); - - /// - /// Determines whether the specified strings are not . - /// - /// The strings to check. - /// if all the strings in the enumerable are not ; otherwise, . - public static bool IsNotNull(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.IsNull()); - /// /// Determines whether the specified string is not or . /// @@ -280,27 +154,6 @@ public static partial class YANText /// if any of the strings in the enumerable is not or ; otherwise, . public static bool IsNotNullAndEmpty(this IEnumerable strs) => strs is not null && !strs.Any(s => s.IsNullOrEmpty()); - /// - /// Determines whether any of the specified strings in the read-only collection is not or . - /// - /// The strings to check. - /// if any of the strings in the read-only collection is not or ; otherwise, . - public static bool IsNotNullAndEmpty(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.IsNullOrEmpty()); - - /// - /// Determines whether any of the specified strings in the read-only list is not or . - /// - /// The strings to check. - /// if any of the strings in the read-only list is not or ; otherwise, . - public static bool IsNotNullAndEmpty(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.IsNullOrEmpty()); - - /// - /// Determines whether any of the specified strings in the read-only set is not or . - /// - /// The strings to check. - /// if any of the strings in the read-only set is not or ; otherwise, . - public static bool IsNotNullAndEmpty(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.IsNullOrEmpty()); - /// /// Determines whether the specified string is not , , or consists only of whitespace characters. /// @@ -322,27 +175,6 @@ public static partial class YANText /// if all the strings in the enumerable are not , , or consist only of whitespace characters; otherwise, . public static bool IsNotNullAndWhiteSpace(this IEnumerable strs) => strs is not null && !strs.Any(s => s.IsNullOrWhiteSpace()); - /// - /// Determines whether all the specified strings in the read-only collection are not , , or consist only of whitespace characters. - /// - /// The strings to check. - /// if all the strings in the read-only collection are not , , or consist only of whitespace characters; otherwise, . - public static bool IsNotNullAndWhiteSpace(this IReadOnlyCollection strs) => strs is not null && !strs.Any(s => s.IsNullOrWhiteSpace()); - - /// - /// Determines whether all the specified strings in the read-only list are not , , or consist only of whitespace characters. - /// - /// The strings to check. - /// if all the strings in the read-only list are not , , or consist only of whitespace characters; otherwise, . - public static bool IsNotNullAndWhiteSpace(this IReadOnlyList strs) => strs is not null && !strs.Any(s => s.IsNullOrWhiteSpace()); - - /// - /// Determines whether all the specified strings in the read-only set are not , , or consist only of whitespace characters. - /// - /// The strings to check. - /// if all the strings in the read-only set are not , , or consist only of whitespace characters; otherwise, . - public static bool IsNotNullAndWhiteSpace(this IReadOnlySet strs) => strs is not null && !strs.Any(s => s.IsNullOrWhiteSpace()); - /// /// Determines whether two specified strings are not equal, based on their values. /// @@ -439,28 +271,6 @@ public static bool NotEquals(this IReadOnlyList strs) return true; } - /// - /// Determines whether all the strings in the specified enumerable are distinct, based on their values. - /// - /// The strings to check. - /// if all the strings in the specified enumerable are distinct, based on their values; otherwise, . - public static bool NotEquals(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 2) - { - return false; - } - var hashSet = new HashSet(strs.Count); - foreach (var str in strs) - { - if (!hashSet.Add(str)) - { - return false; - } - } - return true; - } - /// /// Determines whether two specified strings are not equal, ignoring their casing, based on their values using ordinal comparison. /// @@ -557,28 +367,6 @@ public static bool NotEqualsIgnoreCase(this IReadOnlyList strs) return true; } - /// - /// Determines whether all the strings in the specified enumerable are distinct, ignoring their casing, based on their values using ordinal comparison. - /// - /// The strings to check. - /// if all the strings in the specified enumerable are distinct, ignoring their casing, based on their values using ordinal comparison; otherwise, . - public static bool NotEqualsIgnoreCase(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 2) - { - return false; - } - var hashSet = new HashSet(strs.Count, StringComparer.OrdinalIgnoreCase); - foreach (var str in strs) - { - if (!hashSet.Add(str)) - { - return false; - } - } - return true; - } - /// /// Returns the non-null string value or if it is . /// @@ -680,23 +468,6 @@ public static IEnumerable ToLower(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings converted to lowercase, ignoring their casing, based on their Unicode values. - /// - /// The strings to convert to lowercase. - /// An enumerable of strings converted to lowercase, ignoring their casing, based on their Unicode values. - public static IEnumerable ToLower(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return ToLower(str); - } - } - /// /// Converts the strings in the specified list to lowercase, ignoring their casing, based on their Unicode values. /// @@ -787,23 +558,6 @@ public static IEnumerable ToLowerInvariant(this IReadOnlyList st } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings converted to lowercase, ignoring their casing, based on their Unicode values using the invariant culture. - /// - /// The strings to convert to lowercase. - /// An enumerable of strings converted to lowercase, ignoring their casing, based on their Unicode values using the invariant culture. - public static IEnumerable ToLowerInvariant(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return ToLowerInvariant(str); - } - } - /// /// Converts all strings in the specified string list to lowercase using the invariant culture, by modifying the list in-place. /// @@ -894,23 +648,6 @@ public static IEnumerable ToUpper(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings converted to uppercase, ignoring their casing, using the invariant culture. - /// - /// The strings to convert to uppercase. - /// An enumerable of strings converted to uppercase, ignoring their casing, using the invariant culture. - public static IEnumerable ToUpper(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return ToUpper(str); - } - } - /// /// Converts all strings in the specified list of strings to uppercase, by modifying the list in-place. /// @@ -1001,23 +738,6 @@ public static IEnumerable ToUpperInvariant(this IReadOnlyList st } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings converted to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - /// - /// The strings to convert to uppercase. - /// An enumerable of strings converted to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - public static IEnumerable ToUpperInvariant(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return ToUpperInvariant(str); - } - } - /// /// Converts all strings in the specified string list to uppercase using the invariant culture, by modifying the list in-place. /// diff --git a/lib/YANLib/YANText.cs b/lib/YANLib/YANText.cs index aa7282e3..b9f49963 100644 --- a/lib/YANLib/YANText.cs +++ b/lib/YANLib/YANText.cs @@ -80,23 +80,6 @@ public static IEnumerable ToTitle(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings converted to title case using the current culture's text info. - /// - /// The strings to convert to title case. - /// An enumerable of strings converted to title case using the current culture's text info. - public static IEnumerable ToTitle(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToTitle(); - } - } - /// /// Converts all strings in the specified list to title case using the current culture's text info, by modifying the list in-place. /// @@ -208,23 +191,6 @@ public static IEnumerable ToCapitalize(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings with the first character of each word capitalized and the remaining characters in lowercase, based on the current culture's text info. - /// - /// The strings to capitalize. - /// An enumerable of strings with the first character of each word capitalized and the remaining characters in lowercase, based on the current culture's text info. - public static IEnumerable ToCapitalize(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.ToCapitalize(); - } - } - /// /// Converts all strings in the specified string list to capitalize form, by modifying the list in-place. /// The first character of each word is capitalized and the remaining characters are converted to lowercase, based on the current culture's text info. @@ -348,24 +314,6 @@ public static IEnumerable CleanSpace(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings with excess whitespace characters removed from the beginning, end, and within each string. - /// Consecutive whitespace characters are reduced to a single space character. - /// - /// The strings to clean up. - /// An enumerable of strings with excess whitespace characters removed. - public static IEnumerable CleanSpace(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.CleanSpace(); - } - } - /// /// Removes excess whitespace characters from the beginning, end, and within each string in the specified list of strings, by modifying the list in-place. /// Consecutive whitespace characters are reduced to a single space character. @@ -477,23 +425,6 @@ public static IEnumerable FormatName(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings with each string formatted by filtering out non-alphabetic characters and converting the remaining characters to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - /// - /// The strings to format by filtering out non-alphabetic characters and converting the remaining characters to uppercase. - /// An enumerable of strings with each string formatted by filtering out non-alphabetic characters and converting the remaining characters to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. - public static IEnumerable FormatName(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.FormatName(); - } - } - /// /// Formats a list of strings in place by filtering out non-alphabetic characters and converting the remaining characters to uppercase, ignoring their casing, based on their Unicode values using the invariant culture. /// @@ -605,24 +536,6 @@ public static IEnumerable FilterAlphabetic(this IReadOnlyList st } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings with all non-alphabetic characters filtered out, based on their Unicode values. - /// Empty or null strings are returned as is. - /// - /// The strings to filter out non-alphabetic characters from. - /// An enumerable of strings with all non-alphabetic characters filtered out, based on their Unicode values. - public static IEnumerable FilterAlphabetic(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.FilterAlphabetic(); - } - } - /// /// Filters out all non-alphabetic characters from the strings in the specified list based on their Unicode values. /// @@ -733,24 +646,6 @@ public static IEnumerable FilterNumber(this IReadOnlyList strs) } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings with all numeric characters filtered out, based on their Unicode values. - /// If a string is empty or whitespace, it is returned as-is. - /// - /// The strings to filter out numeric characters from. - /// An enumerable of strings with all numeric characters filtered out, based on their Unicode values. - public static IEnumerable FilterNumber(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.FilterNumber(); - } - } - /// /// Filters out all numeric characters from the strings in the specified list, based on their Unicode values. /// If a string in the list is empty or whitespace, it is left unchanged. @@ -858,23 +753,6 @@ public static IEnumerable FilterAlphanumeric(this IReadOnlyList } } - /// - /// Enumerates through an enumerable of strings and returns a new enumerable of strings with all non-alphanumeric characters (i.e., characters that are not numbers or letters) filtered out. - /// - /// The strings to filter out non-alphanumeric characters from. - /// An enumerable of strings with all non-alphanumeric characters filtered out. - public static IEnumerable FilterAlphanumeric(this IReadOnlySet strs) - { - if (strs is null || strs.Count < 1) - { - yield break; - } - foreach (var str in strs) - { - yield return str.FilterAlphanumeric(); - } - } - /// /// Modifies the strings in the specified list by filtering out all non-alphanumeric characters (i.e., characters that are not numbers or letters). ///