The Labs \ Source Viewer \ SSCLI \ System.Xml.Serialization \ XmlAnyElementAttribute

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlAnyElementAttribute.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. // <owner current="true" primary="true">ElenaK</owner>
  15. //------------------------------------------------------------------------------
  16. namespace System.Xml.Serialization
  17. {
  18.     using System;
  19.     using System.Xml.Schema;
  20.    
  21.     /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute"]/*' />
  22.     /// <devdoc>
  23.     /// <para>[To be supplied.]</para>
  24.     /// </devdoc>
  25.     [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true)]
  26.     public class XmlAnyElementAttribute : System.Attribute
  27.     {
  28.         string name;
  29.         string ns;
  30.         int order = -1;
  31.         bool nsSpecified = false;
  32.        
  33.         /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.XmlAnyElementAttribute"]/*' />
  34.         /// <devdoc>
  35.         /// <para>[To be supplied.]</para>
  36.         /// </devdoc>
  37.         public XmlAnyElementAttribute()
  38.         {
  39.         }
  40.        
  41.         /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.XmlAnyElementAttribute1"]/*' />
  42.         /// <devdoc>
  43.         /// <para>[To be supplied.]</para>
  44.         /// </devdoc>
  45.         public XmlAnyElementAttribute(string name)
  46.         {
  47.             this.name = name;
  48.         }
  49.        
  50.         /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.XmlAnyElementAttribute2"]/*' />
  51.         /// <devdoc>
  52.         /// <para>[To be supplied.]</para>
  53.         /// </devdoc>
  54.         public XmlAnyElementAttribute(string name, string ns)
  55.         {
  56.             this.name = name;
  57.             this.ns = ns;
  58.             nsSpecified = true;
  59.         }
  60.        
  61.         /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.Name"]/*' />
  62.         /// <devdoc>
  63.         /// <para>[To be supplied.]</para>
  64.         /// </devdoc>
  65.         public string Name {
  66.             get { return name == null ? string.Empty : name; }
  67.             set { name = value; }
  68.         }
  69.        
  70.         /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.Namespace"]/*' />
  71.         /// <devdoc>
  72.         /// <para>[To be supplied.]</para>
  73.         /// </devdoc>
  74.         public string Namespace {
  75.             get { return ns; }
  76.             set {
  77.                 ns = value;
  78.                 nsSpecified = true;
  79.             }
  80.         }
  81.        
  82.         /// <include file='doc\XmlAnyElementAttribute.uex' path='docs/doc[@for="XmlAnyElementAttribute.Order"]/*' />
  83.         /// <devdoc>
  84.         /// <para>[To be supplied.]</para>
  85.         /// </devdoc>
  86.         public int Order {
  87.             get { return order; }
  88.             set {
  89.                 if (value < 0)
  90.                     throw new ArgumentException(Res.GetString(Res.XmlDisallowNegativeValues), "Order");
  91.                 order = value;
  92.             }
  93.         }
  94.        
  95.         internal bool NamespaceSpecified {
  96.             get { return nsSpecified; }
  97.         }
  98.     }
  99. }

Developer Fusion