refactor csproj and add os helper class and some refactors ...
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Runtime.Serialization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
@@ -582,6 +583,18 @@ namespace xCommons.Extensions
|
||||
return Encoding.UTF8.GetBytes(source);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts Byte Array to String Value ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static string FromBytes(this byte[] source)
|
||||
{
|
||||
//
|
||||
var result = Encoding.UTF8.GetString(source, 0, source.Length);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check object is Null ...
|
||||
/// </summary>
|
||||
@@ -624,7 +637,7 @@ namespace xCommons.Extensions
|
||||
{
|
||||
return !source.IsNull() && source.Count() > 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Select Async ...
|
||||
/// </summary>
|
||||
@@ -640,6 +653,29 @@ namespace xCommons.Extensions
|
||||
return await Task.WhenAll(source.Select(async s => await method(s)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts an Enumerable to Async Enumerable ...
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static async IAsyncEnumerable<T> ToAsyncEnumerable<T>(
|
||||
this IEnumerable<T> source,
|
||||
[System.Runtime.CompilerServices.EnumeratorCancellation]
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
//
|
||||
foreach (var item in source)
|
||||
{
|
||||
//
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
yield return item;
|
||||
await Task.Yield(); // keeps method truly async
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update a Collection item ...
|
||||
/// </summary>
|
||||
@@ -1147,7 +1183,7 @@ namespace xCommons.Extensions
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts a List String Representation to GUid List ...
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user