1

In C# I know XML deserializing needs public default constructor. But why deserializing process needs a public constructor?

sources

Community
  • 1
  • 1
Nipuna
  • 6,846
  • 9
  • 64
  • 87

2 Answers2

1

Because it uses it to create an instance of the type.

Emond
  • 50,210
  • 11
  • 84
  • 115
0

Because XmlSerializer uses that constructor to initialize your class and then set the properties.

Selman Genç
  • 100,147
  • 13
  • 119
  • 184