7
的初始JSON表示假設我們有這個節appsettings.json
獲取配置節
{
"crypto":{
"A": "some value",
"B": "foo foo",
"C": "last part"
},
...
}
哪裏"crypto"
一些加密密鑰的JSON序列化。
稍後在代碼中,我需要做這樣的事情:
var keyOptions = CryptoProvider.RestoreFromJson(Configuration.GetSection("crypto"))
但Configuration.GetSection
返回ConfigurationSection
實例。有沒有辦法以某種方式獲取原始json數據?
我認爲ConfigurationSection.Value
應該做的伎倆,但由於某種原因,它總是null
。