Created
January 29, 2018 12:59
-
-
Save akira345/591473a15e90a7b62ba354ad00a15d56 to your computer and use it in GitHub Desktop.
C#でyaml生成テスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Windows.Forms; | |
using YamlDotNet.Serialization; | |
namespace yamltest | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
var calendar = new | |
{ | |
name = "hoge", | |
mount = new | |
{ | |
name = "swap", | |
src = "{{ swap_file_path }}", | |
fstype = "swap", | |
opts = "defaults", | |
passno = "0", | |
dump = "0", | |
state = "present" | |
} | |
}; | |
List<object> calenders = new List<object>(); | |
calenders.Add(calendar); | |
//YAMLにシリアライズしてコンソールに表示 | |
var serializer = new Serializer(); | |
serializer.Serialize(Console.Out, calenders); | |
Console.Read(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment