0

I'm sure I'm getting things wrong, since it is widely used, but this test fails for me:

    using YamlDotNet.Serialization;
    using YamlDotNet.Serialization.NamingConventions;
    class Test
    {
        public int Value { get; set; }
    }
    
    public class Program
    {
        public static void Main()
        {
            var deserializer = new DeserializerBuilder().
                                WithNamingConvention(PascalCaseNamingConvention.Instance)
                                .Build();
            //throws : YamlDotNet.Core.YamlException: 'Property 'value' not found on type 'Test'.'
            var result = deserializer.Deserialize<Test>("value: 25");
        

        }
    }

What I expect is propery Value is assigned from 'value' since I'm using PascalCaseNamingConvention... However I digged in the library code, and at afirst and not extremely deep glance it looks the convention is not used in property lookup.

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115

1 Answers1

0

Naming convention has always to be considered C#--->yaml direction, so in this case the convention to use is CamelCaseNamingConvention.

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115