Can I add custom properties to PasswordCredential.Properties?(我可以向 PasswordCredential.Properties 添加自定义属性吗?)
问题描述
在 WinRT API 中有 Windows.Security.Credentials 命名空间,其中包含 PasswordCredential 类.使用它,我们可以加密敏感数据,如用户名和密码,但该类本身有一个名为Properties"的属性,在我看来,它就像一个方便的容器,用于存放与存储的凭据相关的其他自定义属性,但我无法让它工作.文档中有属性"的只读"访问类型,但我认为这仅意味着我无法更改对它指向的容器的引用.我的问题是:
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 对程序员有用吗?
Is the "Properties" property of PasswordCredential useable for programmers?
抱歉文字有任何错误,您也可以在答案中纠正我的英文,它不是我的母语;)
Sorry for any errors in text, you can also correct my english in the answers, it is not my native language ;)
这可能有用:
以下代码中的Add"方法抛出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 是 PasswordCredentialPropertyStore 该文档将每种方法描述为......保留供内部使用,不打算在您的代码中使用".
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 添加自定义属性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我可以向 PasswordCredential.Properties 添加自定义属性吗?
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01