Show More
Commit Description:
Reformatting.
Commit Description:
Reformatting.
References:
File last commit:
Show/Diff file:
Action:
scripts/LoadYaml.csx
34 lines | 857 B | text/plain | TextLexer
34 lines | 857 B | text/plain | TextLexer
r415 | #r "YamlDotNet.dll" | |||
using YamlDotNet.Serialization; | ||||
public struct NewsItem | ||||
{ | ||||
public string hed; | ||||
public string contents; | ||||
public string source; | ||||
public Dictionary<string, string> variables; | ||||
} | ||||
Console.WriteLine("Hello World"); | ||||
var sr = new StreamReader(@"isometric-park-fna/Content/news_items.yaml"); | ||||
var input = new StringReader(sr.ReadToEnd()); | ||||
var deserializer = new DeserializerBuilder() | ||||
.Build(); | ||||
var items = deserializer.Deserialize<List<NewsItem>>(input); | ||||
Console.WriteLine("news_items.yaml loaded."); | ||||
sr = new StreamReader(@"isometric-park-fna/Content/news_items_pregenerated.yaml"); | ||||
input = new StringReader(sr.ReadToEnd()); | ||||
deserializer = new DeserializerBuilder() | ||||
.Build(); | ||||
items = deserializer.Deserialize<List<NewsItem>>(input); | ||||
Console.WriteLine("news_items_pregenerated.yaml loaded."); | ||||