Stack Overflow Asked on March 1, 2021
So i copied a sample of a website. Its about deserializing YAML into a object graph. I pasted the code into my projekt and most of it works. All the usings are the same. There is only one problem.
var deserializer = new Deserializer(namingConvention: new CamelCaseNamingConvention());
Here a new deserializer instance is created. but my vs underlines namingconvention red. The only difference of my project and the sample, is that my project uses .net core framework and the sample uses .net as a framework. I have honestly no actual clue what the difference between .net and .net core is apart from the fact that .net core is mostly used for server applications, and .net is used for normal applications. (I think lol)
Here is the sample I copied: https://dotnetfiddle.net/HD2JXM
As far as I can see it's preferable to use DeserializerBuilder
in latest versions of the library so the code becomes
var builder = new DeserializerBuilder();
var deserializer = builder
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
According to release notes v4.0.0
The constructors of
Serializer
andDeserializer
are now obsolete Except for the parameterless versions. TheSerializerBuilder
andDeserializerBuilder
classes should now be used to configure and create instances of the (de)serializer.
Correct answer by Alexander on March 1, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP