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,176
  • 8
  • 62
  • 86

2 Answers2

1

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

Emond
  • 49,011
  • 11
  • 81
  • 108
0

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

Selman Genç
  • 97,365
  • 13
  • 115
  • 182