[Mono-devel-list] Relying on the order of Properties comming from reflection

Eran Domb erand at mainsoft.com
Sun Jan 18 03:10:13 EST 2004


Hello,
It looks that the generation of xml schemas is relying on the order of 
the Properties of the System.Xml.Schema.XmlSchema class.
When the XmlReflectionImporter.GetReflectionMembers(Type type) calls 
GetProperties of type XmlSchema, the 'Includes' property come before the 
'Items' property.  If the order is changing (just replace the Items and 
Includes property in the XmlSchema code and compile) the xml generated 
is invalid.
So first I wanted to ask is it correct to build the design relying on 
the order of the Properties coming from reflection, it looks strange 
because the order is not defined and tommorow someone can change the 
order and things will not work.
Second I wanted to know if there are more places we are relying on the 
order of Properties, Methods or Fields coming from reflection, is it a 
common pettern?

Attached is a code sample, and the xml generated when replacing Items 
and includes Properties in XmlSchema.
This is a WebService and the xml is generted when you try to add this 
WebService as a reference to existing project
(the url is .../Service1.asmx?schema=0)

Thanks,
Eran

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Service1.asmx.xml
Type: text/xml
Size: 783 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040118/26a1ac20/attachment.xml 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Service1.asmx.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040118/26a1ac20/attachment.pl 


More information about the Mono-devel-list mailing list