improvements, fixes, etc...
This commit is contained in:
parent
f26f04eec5
commit
981f86c701
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace AyCode.Core.Extensions;
|
namespace AyCode.Core.Extensions;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Linq.Expressions;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using AyCode.Core.Interfaces;
|
using AyCode.Core.Interfaces;
|
||||||
using MessagePack.Resolvers;
|
using MessagePack.Resolvers;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
|
|
@ -41,6 +42,15 @@ public static class SerializeObjectExtensions
|
||||||
return JsonConvert.DeserializeObject(json, toType, Options);
|
return JsonConvert.DeserializeObject(json, toType, Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Using JSON
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDestination"></typeparam>
|
||||||
|
/// <param name="src"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[return: NotNullIfNotNull(nameof(src))]
|
||||||
|
public static TDestination? CloneTo<TDestination>(this object? src) where TDestination : class => src?.ToJson().JsonTo<TDestination>();
|
||||||
|
|
||||||
//public static string ToJson(this Expression source) => JsonConvert.SerializeObject(source, Options);
|
//public static string ToJson(this Expression source) => JsonConvert.SerializeObject(source, Options);
|
||||||
|
|
||||||
public static byte[] ToMessagePack(this object message) => MessagePackSerializer.Serialize(message);
|
public static byte[] ToMessagePack(this object message) => MessagePackSerializer.Serialize(message);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue