2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 11:32:59 +00:00

FromDynamic

This commit is contained in:
Ahmed Zamil 2020-12-11 01:37:00 +03:00
parent b61df304ea
commit df88317b1f
2 changed files with 10 additions and 1 deletions

View File

@ -32,6 +32,7 @@ using Esiur.Data;
using Esiur.Misc; using Esiur.Misc;
using Esiur.Core; using Esiur.Core;
using System.Reflection; using System.Reflection;
using System.Dynamic;
namespace Esiur.Data namespace Esiur.Data
{ {
@ -85,6 +86,14 @@ namespace Esiur.Data
return rt; return rt;
} }
public static Structure FromDynamic(ExpandoObject obj)
{
var rt = new Structure();
foreach (var kv in obj)
rt[kv.Key] = kv.Value;
return rt;
}
public static Structure FromObject(object obj) public static Structure FromObject(object obj)
{ {
var type = obj.GetType(); var type = obj.GetType();

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Description>Distributed Resources Platform</Description> <Description>Distributed Resources Platform</Description>
<Copyright>Ahmed Kh. Zamil</Copyright> <Copyright>Ahmed Kh. Zamil</Copyright>
<PackageLicenseUrl>https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE</PackageLicenseUrl> <PackageLicenseUrl>https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE</PackageLicenseUrl>