[英]when used Dictionary How can I get the value if it non nullable value type
何时使用字典
如果非空值键入此代码,我如何获取该值
Dictionary<string, object> DictionaryValues = new Dictionary<string, object>();
RSAParameters publicKey = Storage.Read(_Path + @"\" + "Key.Public");
DictionaryValues["publicKey"] = publicKey;
RSAParameters publicKey2 = new RSAParameters();
if (DictionaryValues.TryGetValue("publicKey", out object obj))
{
publicKey2 = obj as RSAParameters;
}
我收到一个错误 as 运算符必须与引用类型或可为空类型一起使用 RSAParameters is anon nullable
我如何从字典中获取值 publicKey 请帮忙,谢谢大家
//publicKey2 = obj as RSAParameters;
publicKey2 = (RSAParameters)obj;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.