当前位置: 首页>>代码示例>>C#>>正文


C# MemberAttributes类代码示例

本文整理汇总了C#中MemberAttributes的典型用法代码示例。如果您正苦于以下问题:C# MemberAttributes类的具体用法?C# MemberAttributes怎么用?C# MemberAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MemberAttributes类属于命名空间,在下文中一共展示了MemberAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Method

 public static CodeMemberMethod Method(this CodeTypeDeclaration decleration, MemberAttributes attributes,
     Type returnType, string name)
 {
     var method = new CodeMemberMethod() {Name = name, Attributes = attributes};
     decleration.Members.Add(method);
     return method;
 }
开发者ID:InvertGames,项目名称:uFrame.Editor,代码行数:7,代码来源:CodeDomHelpers.cs

示例2: ConvertToMethodAttributes

        internal static MethodAttributes ConvertToMethodAttributes(MemberAttributes memberAttributes)
        {
            MethodAttributes methodAttributes = MethodAttributes.ReuseSlot;
            // convert access attributes
            if ((memberAttributes & MemberAttributes.AccessMask) == MemberAttributes.Assembly)
                methodAttributes |= MethodAttributes.Assembly;
            else if ((memberAttributes & MemberAttributes.AccessMask) == MemberAttributes.Family)
                methodAttributes |= MethodAttributes.Family;
            else if ((memberAttributes & MemberAttributes.AccessMask) == MemberAttributes.FamilyAndAssembly)
                methodAttributes |= MethodAttributes.FamANDAssem;
            else if ((memberAttributes & MemberAttributes.AccessMask) == MemberAttributes.FamilyOrAssembly)
                methodAttributes |= MethodAttributes.FamORAssem;
            else if ((memberAttributes & MemberAttributes.AccessMask) == MemberAttributes.Private)
                methodAttributes |= MethodAttributes.Private;
            else if ((memberAttributes & MemberAttributes.AccessMask) == MemberAttributes.Public)
                methodAttributes |= MethodAttributes.Public;

            // covert scope attributes 
            if ((memberAttributes & MemberAttributes.ScopeMask) == MemberAttributes.Abstract)
                methodAttributes |= MethodAttributes.Abstract;
            else if ((memberAttributes & MemberAttributes.ScopeMask) == MemberAttributes.Final)
                methodAttributes |= MethodAttributes.Final;
            else if ((memberAttributes & MemberAttributes.ScopeMask) == MemberAttributes.Static)
                methodAttributes |= MethodAttributes.Static;
            //else if ((memberAttributes & MemberAttributes.ScopeMask) == MemberAttributes.Override)
            // methodAttributes |= MethodAttributes.ReuseSlot;// 

            // convert vtable slot
            if ((memberAttributes & MemberAttributes.VTableMask) == MemberAttributes.New)
                methodAttributes |= MethodAttributes.NewSlot;
            //if ((memberAttributes & MemberAttributes.VTableMask) == MemberAttributes.Overloaded)
            // methodAttributes |= MethodAttributes.HideBySig; // 

            return methodAttributes;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:Helper.cs

示例3: AddProperty

        public static CodeMemberProperty AddProperty(this CodeTypeMember member,
            string propertyType, MemberAttributes ma, string name)
        {
            var classCode = member.GetDeclaration();

            return classCode.AddProperty(propertyType, ma, name);
        }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:7,代码来源:Property.cs

示例4: CheckClass

        /// <summary>
        /// Checks the class.
        /// </summary>
        /// <param name="codeType">The code type.</param>
        /// <param name="name">The class name.</param>
        /// <param name="modifiers">The class modifiers.</param>
        /// <param name="members">The count of members in the <paramref name="codeType"/>.</param>
        /// <param name="baseTypes">The class base types.</param>
        public static void CheckClass(CodeTypeDeclaration codeType, string name, MemberAttributes modifiers, int members, params string[] baseTypes)
        {
            Assert.IsTrue(codeType.IsClass,
                String.Format(CultureInfo.CurrentCulture, Settings.Default.IsNotClass, codeType.Name));
            Assert.AreEqual(name, codeType.Name, Settings.Default.InvalidName);
            Assert.AreEqual(modifiers, codeType.Attributes,
                String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidAccessModifier, name));

            if (baseTypes != null)
            {
                Assert.AreEqual(baseTypes.Length, codeType.BaseTypes.Count,
                    String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberBaseTypes, name));
                for (int i = 0; i < baseTypes.Length; i++)
                {
                    Assert.AreEqual(baseTypes[i], codeType.BaseTypes[i].BaseType,
                        String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidBaseType, name));
                }
            }
            else
            {
                Assert.AreEqual(0, codeType.BaseTypes.Count,
                    String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberBaseTypes, name));
            }

            Assert.AreEqual(members, codeType.Members.Count,
                String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberMembers, name));
        }
开发者ID:vestild,项目名称:nemerle,代码行数:35,代码来源:ParseHelper.cs

示例5: AddFieldDeclaration

 internal static CodeMemberField AddFieldDeclaration(CodeTypeDeclaration type, MemberAttributes memberAttribute, string fieldType, string fieldName)
 {
     CodeMemberField cmf = new CodeMemberField(fieldType, fieldName);
     cmf.Attributes = memberAttribute;
     type.Members.Add(cmf);
     return cmf;
 }
开发者ID:JamesTryand,项目名称:NetSqlAzMan,代码行数:7,代码来源:CodeDomHelper.cs

示例6: AddEvent

        public static CodeMemberEvent AddEvent(this CodeTypeMember member,
            Type delegateType, MemberAttributes ma, string name)
        {
            var classCode = member.GetDeclaration();

            return classCode.AddEvent(delegateType, ma, name);
        }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:7,代码来源:Event.cs

示例7: CreateInterface

        public static CodeTypeDeclaration CreateInterface (string name, MemberAttributes attribute) {
            CodeTypeDeclaration ct = new CodeTypeDeclaration (name);
            ct.Attributes = attribute;
            ct.IsInterface = true;

            return ct;
        }
开发者ID:modulexcite,项目名称:powerpack-archive,代码行数:7,代码来源:CDHelper.cs

示例8: ConvModifiers

		MemberAttributes ConvModifiers(TypeMemberModifiers modifier, MemberAttributes defaultVisibility)
		{
			MemberAttributes attr = 0;
			if ((modifier & TypeMemberModifiers.Abstract) == TypeMemberModifiers.Abstract)
				attr |= MemberAttributes.Abstract;
			if ((modifier & TypeMemberModifiers.Final) == TypeMemberModifiers.Final)
				attr |= MemberAttributes.Const;
			if ((modifier & TypeMemberModifiers.Internal) == TypeMemberModifiers.Internal)
				attr |= MemberAttributes.Assembly;
			if ((modifier & TypeMemberModifiers.Override) == TypeMemberModifiers.Override)
				attr |= MemberAttributes.Override;
			if ((modifier & TypeMemberModifiers.Private) == TypeMemberModifiers.Private)
				attr |= MemberAttributes.Private;
			if ((modifier & TypeMemberModifiers.Protected) == TypeMemberModifiers.Protected)
				attr |= MemberAttributes.Family;
			if ((modifier & TypeMemberModifiers.Public) == TypeMemberModifiers.Public)
				attr |= MemberAttributes.Public;
			if ((modifier & TypeMemberModifiers.Static) == TypeMemberModifiers.Static)
				attr |= MemberAttributes.Static;
			if ((modifier & TypeMemberModifiers.Virtual) != TypeMemberModifiers.Virtual)
				attr |= MemberAttributes.Final;
			if ((modifier & TypeMemberModifiers.VisibilityMask) == TypeMemberModifiers.None)
				attr |= defaultVisibility;
			return attr;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:25,代码来源:CodeDomVisitor.cs

示例9: Struct

 public static CodeTypeDeclaration Struct(string structName, MemberAttributes attributes)
 {
     return new CodeTypeDeclaration(structName)
     {
         Attributes = attributes,
         IsStruct = true
     };
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:8,代码来源:Class.cs

示例10: DesignConnection

 public DesignConnection(string connectionName, System.Data.Design.ConnectionString cs, string provider)
 {
     this.properties = new HybridDictionary();
     this.modifier = MemberAttributes.Assembly;
     this.name = connectionName;
     this.connectionStringObject = cs;
     this.provider = provider;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:DesignConnection.cs

示例11: AddGetProperty

        public static CodeMemberProperty AddGetProperty(this CodeTypeMember member,
            string propertyType, MemberAttributes ma, string name,
            params CodeStatement[] statements)
        {
            var classCode = member.GetDeclaration();

            return classCode.AddGetProperty(propertyType, ma, name, statements);
        }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:8,代码来源:Property.cs

示例12: Interface

 public static CodeTypeDeclaration Interface(string interfaceName, MemberAttributes attributes)
 {
     return new CodeTypeDeclaration(interfaceName)
     {
         Attributes = attributes,
         IsInterface = true
     };
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:8,代码来源:Class.cs

示例13: DrawType

        public virtual void DrawType(XBaseWindow window)
        {
            XBaseWindow.DoButton("Type", ()=> {
                XCodeTypeTemplate.SelectType(x => type = x);
            });

            memberAttribute = (MemberAttributes)XBaseWindow.CreateEnumPopup( memberAttribute );
        }
开发者ID:wuxingogo,项目名称:WuxingogoExtension,代码行数:8,代码来源:XCodeMember.cs

示例14: Enum

 public static CodeTypeDeclaration Enum(string enumName, MemberAttributes attributes)
 {
     return new CodeTypeDeclaration(enumName)
     {
         Attributes = attributes,
         IsEnum = true
     };
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:8,代码来源:Class.cs

示例15: CreateClass

        public static CodeTypeDeclaration CreateClass (string name, MemberAttributes attribute,
                CodeTypeReference[] baseTypes) {
            CodeTypeDeclaration ct = new CodeTypeDeclaration (name);
            ct.Attributes = attribute;
            ct.BaseTypes.AddRange (baseTypes);
            ct.IsClass = true;

            return ct;
        }
开发者ID:modulexcite,项目名称:powerpack-archive,代码行数:9,代码来源:CDHelper.cs


注:本文中的MemberAttributes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。