我将所有字符串存储在Json文件中以进行本地化。如下。
[
{
"Key": "screen",
"Value": "Screen No"
},
{
"Key": "go",
"Value": "Go!"
},
{
"Key": "titlehome",
"Value": "Search Particular Screan"
},
{
"Key": "home",
"Value": "Home"
}]
那么如何在Model for data Notation中访问这些字符串
我创建一个静态函数Utils.value("screen")
并返回该键的值。
答案 0 :(得分:0)
Hi Nasimbahar,
public class josnResult
{
public string Key { get; set; }
public string Value { get; set; }
}
var _listResult= Newtonsoft.Json.JsonConvert.DeserializeObject<List<josnResult>>(jsonValue);
josnResult _josnResult = _listResult.Where(t => t.Key == "screen").FirstOrDefault();
if (_josnResult != null)
{
var _val = _josnResult.Value;
}