/// <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; } }
public void NameDefault () { SoapEnumAttribute attr = new SoapEnumAttribute (); Assert.AreEqual (string.Empty, attr.Name, "#1"); attr.Name = null; Assert.AreEqual (string.Empty, attr.Name, "#2"); }
/// <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; } }
/// <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; } } }
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; } }
/// <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; } }