CodeMemberProperty.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / CodeDOM / CodeMemberProperty.cs / 1305376 / CodeMemberProperty.cs

                            //------------------------------------------------------------------------------ 
// 
//
// [....]
//     Copyright (c) Microsoft Corporation.  All rights reserved. 
// 
//----------------------------------------------------------------------------- 
 
namespace System.CodeDom {
 
    using System.Diagnostics;
    using System;
    using Microsoft.Win32;
    using System.Collections; 
    using System.Runtime.InteropServices;
 
    ///  
    ///    
    ///       Represents a class property. 
    ///    
    /// 
    [
        ClassInterface(ClassInterfaceType.AutoDispatch), 
        ComVisible(true),
        Serializable, 
    ] 
    public class CodeMemberProperty : CodeTypeMember {
        private CodeTypeReference type; 
        private CodeParameterDeclarationExpressionCollection parameters = new CodeParameterDeclarationExpressionCollection();
        private bool hasGet;
        private bool hasSet;
        private CodeStatementCollection getStatements = new CodeStatementCollection(); 
        private CodeStatementCollection setStatements = new CodeStatementCollection();
        private CodeTypeReference privateImplements = null; 
        private CodeTypeReferenceCollection implementationTypes = null; 

        ///  
        ///    [To be supplied.]
        /// 
        public CodeTypeReference PrivateImplementationType {
            get { 
                return privateImplements;
            } 
            set { 
                privateImplements = value;
            } 
        }

        /// 
        ///    [To be supplied.] 
        /// 
        public CodeTypeReferenceCollection ImplementationTypes { 
            get { 
                if (implementationTypes == null) {
                    implementationTypes = new CodeTypeReferenceCollection(); 
                }
                return implementationTypes;
            }
        } 

        ///  
        ///    Gets or sets the data type of the property. 
        /// 
        public CodeTypeReference Type { 
            get {
                if (type == null) {
                    type = new CodeTypeReference("");
                } 
                return type;
            } 
            set { 
                type = value;
            } 
        }

        /// 
        ///     
        ///       Gets a value
        ///       indicating whether the property has a get method accessor. 
        ///     
        /// 
        public bool HasGet { 
            get {
                return hasGet || getStatements.Count > 0;
            }
            set { 
                hasGet = value;
                if (!value) { 
                    getStatements.Clear(); 
                }
            } 
        }

        /// 
        ///     
        ///       Gets a value
        ///       indicating whether the property has a set method accessor. 
        ///     
        /// 
        public bool HasSet { 
            get {
                return hasSet || setStatements.Count > 0;
            }
            set { 
                hasSet = value;
                if (!value) { 
                    setStatements.Clear(); 
                }
            } 
        }

        /// 
        ///     
        ///       Gets or sets the collection of get statements for the
        ///       property. 
        ///     
        /// 
        public CodeStatementCollection GetStatements { 
            get {
                return getStatements;
            }
        } 

        ///  
        ///     
        ///       Gets or sets the collection of get statements for the property.
        ///     
        /// 
        public CodeStatementCollection SetStatements {
            get {
                return setStatements; 
            }
        } 
 
        /// 
        ///     
        ///       Gets or sets the collection of declaration expressions
        ///       for
        ///       the property.
        ///     
        /// 
        public CodeParameterDeclarationExpressionCollection Parameters { 
            get { 
                return parameters;
            } 
        }
    }
}

// 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