File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ var config = TomlSerializer.Deserialize<MyConfig>(stream);
3737using System .Text ;
3838using Tomlyn ;
3939
40- var utf8 = Encoding .UTF8 .GetBytes (" name = \" Ada\" " );
40+ var utf8 = Encoding .UTF8 .GetBytes (" Name = \" Ada\" " );
4141var person = TomlSerializer .Deserialize <Person >(utf8 );
4242```
4343
Original file line number Diff line number Diff line change @@ -32,16 +32,19 @@ og_type: website
3232 <div class="card-body">
3333
3434``` csharp
35+ using System .Text .Json ;
3536using Tomlyn ;
3637
3738public sealed record Person (string Name , int Age );
3839
39- var toml = TomlSerializer .Serialize (new Person (" Ada" , 37 ));
40+ var options = new TomlSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy .CamelCase };
41+
42+ var toml = TomlSerializer .Serialize (new Person (" Ada" , 37 ), options );
4043
4144// name = "Ada"
4245// age = 37
4346
44- var person = TomlSerializer .Deserialize <Person >(toml );
47+ var person = TomlSerializer .Deserialize <Person >(toml , options );
4548```
4649
4750</div >
You can’t perform that action at this time.
0 commit comments