Open tihb666 opened 4 months ago
public TValue ThrowOrValue<TValue>(Func<object, TValue> value)
{
if (IsError) throw new RedisServerException(this.SimpleError);
var newval = value(this.Value);
if (newval == null && typeof(TValue).IsArray) newval = (TValue)typeof(TValue).CreateInstanceGetDefaultValue();
this.Value = newval;
return newval;
}
if (newval == null && typeof(TValue).IsArray)
好,自己加了一个判断:
if (typeof(T).IsArray)
{
if(result == null || (result as Array).Length == 0)
{
return default(T);
}
}
类:RedisClient,方法:public T Get(string key);
调用:.Get<string[]>("fdfawerere");
只有数组有这个问题,其他list,或string或实体都是正常的返回NULL,就数组返回了一个长度为0的数组,而不是NULL。