更新wtm

This commit is contained in:
zgf committed 2023-08-11 15:55:50 +08:00
1 parent f119665d29
commit 3467d4aa9d
60 files changed
+1932 -397

No files matched your search

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace WalkingTec.Mvvm.Core.Extensions
{
public static class DictionaryExtension
{
public static T GetValue<T>(this Dictionary<string,object> self, string key)
{
if (self.ContainsKey(key))
{
object v = self[key];
if(v is JsonElement j)
{
v = j.ToString();
}
var cv = v.ConvertValue(typeof(T));
if (cv == null)
{
return default(T);
}
else
{
return (T)cv;
}
}
else
{
return default(T);
}
}
}
}