Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating Internal C# classes from XSD.exe

Tags:

c#

xsd.exe

I'm writing a library that will accept an XML string as input which it will deserialize and do some transformations on. The output will be a separate XML file with a different schema.

This internal XML will be following an internal Schema, which I do not wish to expose to the user of the library. The schema is defined in an XSD file in my project which I use XSD.exe (the one that comes bundled with Visual Studio) to create C# classes from.

The problem I have is that XSD.exe generates public classes. I would want them to be implicit or explicit internal.

Is there anyway I can make XSD.exe create internal classes?

like image 381
Mats Fredriksson Avatar asked Apr 03 '13 15:04

Mats Fredriksson


1 Answers

No, it won't create internal classes. Classes output by XSD.EXE are intended to be serialized by the XMLSerializer. The XMLSerializer only supports public classes and thus if XSD output internal classes, serialization would fail.

like image 140
Peter Ritchie Avatar answered Sep 20 '22 08:09

Peter Ritchie