如何从应用程序设置中获取与应用程序设置中的值关联的键名称
谁能告诉我如何获取与
中的值关联的键名称
can anyone tell me how to get the key name associated with a value in <app settings>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不完全清楚您想要在这里实现什么,但您始终可以迭代所有 appSettings 并比较它们的值。如果您找到了您要找的人,请拿走它的钥匙。
注意:从值到键的反向映射当然不一定是唯一的,即您必须处理这样一个事实:您使用搜索谓词的值与多个键匹配。
Not entirely clear what you want to achieve here, but you could always just iterate over all appSettings and compare their values. If you find the one you're looking for take it's key.
NOTE: The reverse mapping from value to key is of course not necessarily unique, i.e. you would have to deal with the fact, that the value you're using a search predicate matches more than one key.