Ejemplo n.º 1
0
 /// <summary>
 /// 获取支持 <see cref="RedisValue"/>包装的运行时属性
 /// 支持 <see cref="Type.IsValueType"/> 和 <see cref="T:string"/>
 /// </summary>
 /// <remarks>
 /// 支持类型:
 /// - string
 /// - DateTime
 /// - int
 /// - uint
 /// - double
 /// - byte[]
 /// - bool
 /// - long
 /// - ulong
 /// - float
 /// - ReadOnlyMemory&gt;byte&lt;
 /// - Memory&gt;byte&lt;
 /// - RedisValue
 /// </remarks>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 private static PropertyInfo[] GetProperties <T> ()
 {
     return(PropertiesCache <T> .GetProperties());
 }
Ejemplo n.º 2
0
 public static IDictionary <string, object> ToDictionary(this object item)
 {
     return(PropertiesCache.GetProperties(item).ToDictionary(prop => prop.Name, prop => prop.GetValue(item, null)));
 }