• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MemberAttributes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GetModifier

		public String GetModifier(MemberAttributes memberAttributes)
		{
			switch (memberAttributes & MemberAttributes.ScopeMask)
			{
				case MemberAttributes.Final: return "";
				case MemberAttributes.Abstract: return "abstract ";
				case MemberAttributes.Override: return "override ";
				default: return "virtual ";
			}
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:10,代码来源:T4Classes.cs


示例17: ItemField

 /// <summary>
 /// 字段
 /// <para>eg. public Dictionary<string,string> TestDic = new Dictionary<string,string>();</para>
 /// </summary>
 /// <param name="inLeft">字段类型</param>
 /// <param name="inFieldName"></param>
 /// <param name="inRight"></param>
 public ItemField(string inLeft, string inFieldName, string inRight = "", MemberAttributes inAtt = MemberAttributes.Private)
 {
     field = new CodeMemberField(inLeft, inFieldName);
     if (inRight != "")
     {
         CodeVariableReferenceExpression right = new CodeVariableReferenceExpression(inRight);
         field.InitExpression = right;
     }
     field.Attributes = inAtt;
 }
开发者ID:killliu,项目名称:AutoCSharp,代码行数:17,代码来源:ItemField.cs


示例18: GenerateField

        public void GenerateField(String name,Type type ,MemberAttributes MemberAttributes = MemberAttributes.Public)
        {
            if (CodeCompileUnit == null)
                throw new Exception("Call Generate Class Before");

            CodeMemberField CodeMemberField = new CodeMemberField();
            CodeMemberField.Attributes = MemberAttributes;
            CodeMemberField.Type = new CodeTypeReference(type);
            CodeMemberField.Name = name;
            derived.Members.Add(CodeMemberField);
        }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:11,代码来源:Generator.cs


示例19: ModifyMemberAttributes

        protected override MemberAttributes ModifyMemberAttributes(MemberAttributes memberAttributes)
        {
            // Methods are usually virtual ...
            var result = base.ModifyMemberAttributes(memberAttributes) & ~MemberAttributes.Final;

            // ... and override on derived types
            if (this.m.ObjectClass != this.dt)
                result = result | MemberAttributes.Override;

            return result;
        }
开发者ID:daszat,项目名称:zetbox,代码行数:11,代码来源:Method.cs


示例20: Event

        public static CodeMemberEvent Event(CodeTypeReference delegateType, MemberAttributes ma, string name)
        {
            var c = new CodeMemberEvent
            {
                Name = name,
                Attributes = ma,
                Type = delegateType,
            };

            return c;
        }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:11,代码来源:Event.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MemberBinder类代码示例发布时间:2022-05-24
下一篇:
C# MemberAccessor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap