0
我正在使用JsonConvert和JsonSerializerSettings從JSON讀取數據,但我沒有觸及文化。將手機操作系統語言從en-US更改爲nl-NL,我失去了我的NumberFormat。是否可以設置應用程序的NumberFormat?在應用程序級別指定NumberFormat
using (Stream stream = accessStream.AsStreamForRead((int)accessStream.Size))
{
byte[] content = new byte[stream.Length];
await stream.ReadAsync(content, 0, (int)stream.Length);
string json = Encoding.UTF8.GetString(content, 0, content.Length);
System.Diagnostics.Debug.WriteLine("Read from file: " + json);
JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
serializerSettings.NullValueHandling = NullValueHandling.Ignore;
List<T> objects = JsonConvert.DeserializeObject<List<T>>(json, serializerSettings);
return objects;
}
我使用JSON到底Culture財產,沒有理由堅持XML。 – Boris