我可以将自定义属性添加到PasswordCredential.Properties吗? [英] Can I add custom properties to PasswordCredential.Properties?

查看:55
本文介绍了我可以将自定义属性添加到PasswordCredential.Properties吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WinRT API中,存在Windows.Security.Credentials命名空间,其中包含

In WinRT API there is Windows.Security.Credentials namespace which contains the PasswordCredential class. Using it we can encrypt sensitive data like user names and passwords but the class itself has a property named "Properties" which looks to me like a handy container for other custom properties somehow related to the stored credential but I can't get it to work. There is a "Read-only" access type for the "Properties" in the documentation but I thought that meant only that I can't change the reference to the container it points to. My question is:

PasswordCredential 对程序员有用吗?

很抱歉文本中有任何错误,您也可以在答案中更正我的英语,这不是我的母语;)

Sorry for any errors in text, you can also correct my english in the answers, it is not my native language ;)

这可能有用:

以下代码中的添加"方法引发ArgumentException:

The "Add" method in the following code throws ArgumentException:

PasswordVault v = new PasswordVault();
PasswordCredential c = new PasswordCredential("TEST", "TEST", "TEST");
c.Properties.Add("Name", "testName");
v.Add(c);

推荐答案

不幸的是,PasswordCredentials.Properties是

Unfortunately, the PasswordCredentials.Properties is an instance of PasswordCredentialPropertyStore which documentation describes every method as "...reserved for internal use and not intended to be used in your code".

这就是为什么它对程序员不可用的原因.

That's why it is not useable for programmers.

这篇关于我可以将自定义属性添加到PasswordCredential.Properties吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆