示例#1
0
        public static CodeTypeDeclaration EncapsulatedField(this CodeTypeDeclaration decleration, Type fieldType,
                                                            string name, string propertyName, CodeExpression lazyValue, bool publicField = false)
        {
            var field = new CodeMemberField(fieldType, name);

            if (publicField)
            {
                field.Attributes = MemberAttributes.Public;
            }
            decleration.Members.Add(field);
            decleration.EncapsulateField(field, propertyName, lazyValue);
            return(decleration);
        }