SoapAttributes.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / Serialization / SoapAttributes.cs / 1305376 / SoapAttributes.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Xml.Serialization { 
    using System;
    using System.Reflection; 
    using System.Collections;
    using System.ComponentModel;

    internal enum SoapAttributeFlags { 
        Enum = 0x1,
        Type = 0x2, 
        Element = 0x4, 
        Attribute = 0x8,
    } 

    /// 
    /// 
    ///    [To be supplied.] 
    /// 
    public class SoapAttributes { 
        bool soapIgnore; 
        SoapTypeAttribute soapType;
        SoapElementAttribute soapElement; 
        SoapAttributeAttribute soapAttribute;
        SoapEnumAttribute soapEnum;
        object soapDefaultValue = null;
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapAttributes() { 
        }

        /// 
        ///  
        ///    [To be supplied.]
        ///  
        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;
            } 
        }

        internal SoapAttributeFlags SoapFlags {
            get { 
                SoapAttributeFlags flags = 0;
                if (soapElement != null) flags |= SoapAttributeFlags.Element; 
                if (soapAttribute != null) flags |= SoapAttributeFlags.Attribute; 
                if (soapEnum != null) flags |= SoapAttributeFlags.Enum;
                if (soapType != null) flags |= SoapAttributeFlags.Type; 
                return flags;
            }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapTypeAttribute SoapType { 
            get { return soapType; }
            set { soapType = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapEnumAttribute SoapEnum { 
            get { return soapEnum; }
            set { soapEnum = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public bool SoapIgnore { 
            get { return soapIgnore; }
            set { soapIgnore = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapElementAttribute SoapElement { 
            get { return soapElement; }
            set { soapElement = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapAttributeAttribute SoapAttribute { 
            get { return soapAttribute; }
            set { soapAttribute = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public object SoapDefaultValue { 
            get { return soapDefaultValue; }
            set { soapDefaultValue = value; }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Xml.Serialization { 
    using System;
    using System.Reflection; 
    using System.Collections;
    using System.ComponentModel;

    internal enum SoapAttributeFlags { 
        Enum = 0x1,
        Type = 0x2, 
        Element = 0x4, 
        Attribute = 0x8,
    } 

    /// 
    /// 
    ///    [To be supplied.] 
    /// 
    public class SoapAttributes { 
        bool soapIgnore; 
        SoapTypeAttribute soapType;
        SoapElementAttribute soapElement; 
        SoapAttributeAttribute soapAttribute;
        SoapEnumAttribute soapEnum;
        object soapDefaultValue = null;
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapAttributes() { 
        }

        /// 
        ///  
        ///    [To be supplied.]
        ///  
        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;
            } 
        }

        internal SoapAttributeFlags SoapFlags {
            get { 
                SoapAttributeFlags flags = 0;
                if (soapElement != null) flags |= SoapAttributeFlags.Element; 
                if (soapAttribute != null) flags |= SoapAttributeFlags.Attribute; 
                if (soapEnum != null) flags |= SoapAttributeFlags.Enum;
                if (soapType != null) flags |= SoapAttributeFlags.Type; 
                return flags;
            }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapTypeAttribute SoapType { 
            get { return soapType; }
            set { soapType = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapEnumAttribute SoapEnum { 
            get { return soapEnum; }
            set { soapEnum = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public bool SoapIgnore { 
            get { return soapIgnore; }
            set { soapIgnore = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapElementAttribute SoapElement { 
            get { return soapElement; }
            set { soapElement = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public SoapAttributeAttribute SoapAttribute { 
            get { return soapAttribute; }
            set { soapAttribute = value; }
        }
 
        /// 
        ///  
        ///    [To be supplied.] 
        /// 
        public object SoapDefaultValue { 
            get { return soapDefaultValue; }
            set { soapDefaultValue = value; }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK