Last active
August 29, 2015 14:01
-
-
Save evandroamparo/094ff8d209e6978dc66a to your computer and use it in GitHub Desktop.
Ini.Net serializer
This file contains hidden or 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
var iniFile = new IniFile("arquivo.ini"); | |
var config = new Configuracao(); | |
var serializer = new IniSerializer(typeof(Configuracao)); | |
//var serializer = new IniSerializer<Configuracao>(); | |
... | |
config.Fonte.Negrito = true; | |
config.Fonte.Nome = "Arial"; | |
serializer.Serialize(config, iniFile); | |
//[Fonte] | |
//Negrito=TRUE | |
//Nome=Arial | |
... | |
config = (Configuracao) serializer.Deserialize(iniFile); | |
... | |
public class Configuracao | |
{ | |
[IniSection("Fonte")] | |
public Fonte Fonte; | |
} | |
public class Fonte | |
{ | |
public bool Negrito; | |
public string Nome; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment