开发者

difference between [XmlText] and [System.Xml.Serialization.XmlTextAttribute()]

xsd generates [System.Xml.Serialization.XmlTextAttribute()], is it exactly equal to 开发者_如何学Python[XmlText] attribute? why xsd generates the simple one?


It is the same thing.

All xxxAttribute classes can be used as simply xxx.

For example, you would usually use [Serializable] instead of the full name - SerializableAttribute.

The compiler "knows" that when you use [] this is an attribute.

See the examples at the bottom of the Attribute MSDN page.


XSD generates the full name in order to be on the safe side - there is no way for the tool writers to know if you have created your own attribute with this name. Fully qualifying the name and namespace makes things less likely to break.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜