Nipuna
Nipuna

Reputation: 7026

Why deserializing need public default constructor

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

sources

Upvotes: 1

Views: 74

Answers (2)

Emond
Emond

Reputation: 50682

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

Upvotes: 1

Selman Genç
Selman Genç

Reputation: 101701

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

Upvotes: 0

Related Questions