Hello, how can I generate a xsd schema for a c# type (in code). There must be certainly a way, because xsd schema is generated for datacontracts in wcf.
+1
A:
You can use the XML Schema Definition Tool (xsd.exe)
xsd.exe YourAssembly.dll /type:YourNamespace.YourType
Thomas Levesque
2010-05-02 13:45:17
Yeah I know, but I want to generate the schema in code, not via tool.
s7orm
2010-05-02 17:09:17
A:
So, I found a solution to my problem by looking with reflector in the xsd.exe. Here is it for future reference:
XmlReflectionImporter importer = new XmlReflectionImporter();
XmlTypeMapping stringMapping = importer.ImportTypeMapping(typeof(String));
s7orm
2010-05-05 02:22:55