Inheritance: System.Attribute
Exemplo n.º 1
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Xml.Serialization.SoapAttributes" /> class using the specified custom type.</summary>
 /// <param name="provider">Any object that implements the <see cref="T:System.Reflection.ICustomAttributeProvider" /> interface, such as the <see cref="T:System.Type" /> class. </param>
 public SoapAttributes(ICustomAttributeProvider provider)
 {
     object[] customAttributes = provider.GetCustomAttributes(false);
     foreach (object obj in customAttributes)
     {
         if (obj is SoapAttributeAttribute)
         {
             this.soapAttribute = (SoapAttributeAttribute)obj;
         }
         else if (obj is DefaultValueAttribute)
         {
             this.soapDefaultValue = ((DefaultValueAttribute)obj).Value;
         }
         else if (obj is SoapElementAttribute)
         {
             this.soapElement = (SoapElementAttribute)obj;
         }
         else if (obj is SoapEnumAttribute)
         {
             this.soapEnum = (SoapEnumAttribute)obj;
         }
         else if (obj is SoapIgnoreAttribute)
         {
             this.soapIgnore = true;
         }
         else if (obj is SoapTypeAttribute)
         {
             this.soapType = (SoapTypeAttribute)obj;
         }
     }
 }
 /// <include file='doc\SoapAttributes.uex' path='docs/doc[@for="SoapAttributes.SoapAttributes1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapAttributes(ICustomAttributeProvider provider) {
     object[] attrs = provider.GetCustomAttributes(false);
     for (int i = 0; i < attrs.Length; i++) {
         if (attrs[i] is SoapIgnoreAttribute || attrs[i] is ObsoleteAttribute) {
             this.soapIgnore = true;
             break;
         }
         else if (attrs[i] is SoapElementAttribute) {
             this.soapElement = (SoapElementAttribute)attrs[i];
         }
         else if (attrs[i] is SoapAttributeAttribute) {
             this.soapAttribute = (SoapAttributeAttribute)attrs[i];
         }
         else if (attrs[i] is SoapTypeAttribute) {
             this.soapType = (SoapTypeAttribute)attrs[i];
         }
         else if (attrs[i] is SoapEnumAttribute) {
             this.soapEnum = (SoapEnumAttribute)attrs[i];
         }
         else if (attrs[i] is DefaultValueAttribute) {
             this.soapDefaultValue = ((DefaultValueAttribute)attrs[i]).Value;
         }
     }
     if (soapIgnore) {
         this.soapElement = null;
         this.soapAttribute = null;
         this.soapType = null;
         this.soapEnum = null;
         this.soapDefaultValue = null;
     }
 }
Exemplo n.º 3
0
		public void DataTypeDefault ()
		{
			SoapAttributeAttribute attr = new SoapAttributeAttribute ();
			Assert.AreEqual (string.Empty, attr.DataType, "#1");

			attr.DataType = null;
			Assert.AreEqual (string.Empty, attr.DataType, "#2");
		}
Exemplo n.º 4
0
		public void AttributeNameDefault ()
		{
			SoapAttributeAttribute attr = new SoapAttributeAttribute ();
			Assert.AreEqual (string.Empty, attr.AttributeName, "#1");

			attr.AttributeName = null;
			Assert.AreEqual (string.Empty, attr.AttributeName, "#2");
		}
Exemplo n.º 5
0
        /// <include file='doc\SoapAttributes.uex' path='docs/doc[@for="SoapAttributes.SoapAttributes1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public SoapAttributes(ICustomAttributeProvider provider) {
            soapIgnore = GetAttr(provider, typeof(SoapIgnoreAttribute)) != null;
            if (!soapIgnore) {
                soapElement = (SoapElementAttribute)GetAttr(provider, typeof(SoapElementAttribute));
                soapAttribute = (SoapAttributeAttribute)GetAttr(provider, typeof(SoapAttributeAttribute));
                soapType = (SoapTypeAttribute)GetAttr(provider, typeof(SoapTypeAttribute));
                soapEnum = (SoapEnumAttribute)GetAttr(provider, typeof(SoapEnumAttribute));

                DefaultValueAttribute defaultValueAttribute = (DefaultValueAttribute)GetAttr(provider, typeof(DefaultValueAttribute));
                if (defaultValueAttribute != null) soapDefaultValue = defaultValueAttribute.Value;
            }
        }
Exemplo n.º 6
0
        /// <include file='doc\SoapAttributes.uex' path='docs/doc[@for="SoapAttributes.SoapAttributes1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public SoapAttributes(ICustomAttributeProvider provider)
        {
            soapIgnore = GetAttr(provider, typeof(SoapIgnoreAttribute)) != null;
            if (!soapIgnore)
            {
                soapElement   = (SoapElementAttribute)GetAttr(provider, typeof(SoapElementAttribute));
                soapAttribute = (SoapAttributeAttribute)GetAttr(provider, typeof(SoapAttributeAttribute));
                soapType      = (SoapTypeAttribute)GetAttr(provider, typeof(SoapTypeAttribute));
                soapEnum      = (SoapEnumAttribute)GetAttr(provider, typeof(SoapEnumAttribute));

                DefaultValueAttribute defaultValueAttribute = (DefaultValueAttribute)GetAttr(provider, typeof(DefaultValueAttribute));
                if (defaultValueAttribute != null)
                {
                    soapDefaultValue = defaultValueAttribute.Value;
                }
            }
        }
Exemplo n.º 7
0
		public SoapAttributes (ICustomAttributeProvider provider)
		{
			object[] attributes = provider.GetCustomAttributes(false);
			foreach(object obj in attributes)
			{
				if(obj is SoapAttributeAttribute)
					soapAttribute = (SoapAttributeAttribute) obj;
				else if(obj is DefaultValueAttribute)
					soapDefaultValue = ((DefaultValueAttribute) obj).Value;
				else if(obj is SoapElementAttribute)
					soapElement = (SoapElementAttribute) obj;
				else if(obj is SoapEnumAttribute)
					soapEnum = (SoapEnumAttribute) obj;
				else if(obj is SoapIgnoreAttribute)
					soapIgnore = true;
				else if(obj is SoapTypeAttribute)
					soapType = (SoapTypeAttribute) obj;
			}
		}
Exemplo n.º 8
0
 /// <include file='doc\SoapAttributes.uex' path='docs/doc[@for="SoapAttributes.SoapAttributes1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapAttributes(ICustomAttributeProvider provider)
 {
     object[] attrs = provider.GetCustomAttributes(false);
     for (int i = 0; i < attrs.Length; i++)
     {
         if (attrs[i] is SoapIgnoreAttribute || attrs[i] is ObsoleteAttribute)
         {
             this.soapIgnore = true;
             break;
         }
         else if (attrs[i] is SoapElementAttribute)
         {
             this.soapElement = (SoapElementAttribute)attrs[i];
         }
         else if (attrs[i] is SoapAttributeAttribute)
         {
             this.soapAttribute = (SoapAttributeAttribute)attrs[i];
         }
         else if (attrs[i] is SoapTypeAttribute)
         {
             this.soapType = (SoapTypeAttribute)attrs[i];
         }
         else if (attrs[i] is SoapEnumAttribute)
         {
             this.soapEnum = (SoapEnumAttribute)attrs[i];
         }
         else if (attrs[i] is DefaultValueAttribute)
         {
             this.soapDefaultValue = ((DefaultValueAttribute)attrs[i]).Value;
         }
     }
     if (soapIgnore)
     {
         this.soapElement      = null;
         this.soapAttribute    = null;
         this.soapType         = null;
         this.soapEnum         = null;
         this.soapDefaultValue = null;
     }
 }
Exemplo n.º 9
0
 /// <include file='doc\SoapAttributes.uex' path='docs/doc[@for="SoapAttributes.SoapAttributes1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapAttributes(MemberInfo memberInfo)
 {
     foreach (Attribute attr in memberInfo.GetCustomAttributes(false))
     {
         if (attr is SoapIgnoreAttribute || attr is ObsoleteAttribute)
         {
             _soapIgnore = true;
             break;
         }
         else if (attr is SoapElementAttribute)
         {
             _soapElement = (SoapElementAttribute)attr;
         }
         else if (attr is SoapAttributeAttribute)
         {
             _soapAttribute = (SoapAttributeAttribute)attr;
         }
         else if (attr is SoapTypeAttribute)
         {
             _soapType = (SoapTypeAttribute)attr;
         }
         else if (attr is SoapEnumAttribute)
         {
             _soapEnum = (SoapEnumAttribute)attr;
         }
         else if (attr is DefaultValueAttribute)
         {
             _soapDefaultValue = ((DefaultValueAttribute)attr).Value;
         }
     }
     if (_soapIgnore)
     {
         _soapElement      = null;
         _soapAttribute    = null;
         _soapType         = null;
         _soapEnum         = null;
         _soapDefaultValue = null;
     }
 }
Exemplo n.º 10
0
 /// <include file='doc\SoapAttributes.uex' path='docs/doc[@for="SoapAttributes.SoapAttributes1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public SoapAttributes(MemberInfo memberInfo)
 {
     foreach (Attribute attr in memberInfo.GetCustomAttributes(false))
     {
         if (attr is SoapIgnoreAttribute || attr is ObsoleteAttribute)
         {
             _soapIgnore = true;
             break;
         }
         else if (attr is SoapElementAttribute)
         {
             _soapElement = (SoapElementAttribute)attr;
         }
         else if (attr is SoapAttributeAttribute)
         {
             _soapAttribute = (SoapAttributeAttribute)attr;
         }
         else if (attr is SoapTypeAttribute)
         {
             _soapType = (SoapTypeAttribute)attr;
         }
         else if (attr is SoapEnumAttribute)
         {
             _soapEnum = (SoapEnumAttribute)attr;
         }
         else if (attr is DefaultValueAttribute)
         {
             _soapDefaultValue = ((DefaultValueAttribute)attr).Value;
         }
     }
     if (_soapIgnore)
     {
         _soapElement = null;
         _soapAttribute = null;
         _soapType = null;
         _soapEnum = null;
         _soapDefaultValue = null;
     }
 }
Exemplo n.º 11
0
		public void NamespaceDefault ()
		{
			SoapAttributeAttribute attr = new SoapAttributeAttribute ();
			Assert.IsNull (attr.Namespace);
		}