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


C# TypeAttributes类代码示例

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


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

示例1: RuntimeType

        internal RuntimeType(RuntimeTypeHandle handle)
        {
            this.handle = handle;
            typeStruct = (MetadataTypeStruct*)((uint**)&handle)[0];

            assemblyQualifiedName = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name);    // TODO
            name = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name);                 // TODO
            @namespace = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name);               // TODO
            fullname = Mosa.Runtime.Internal.InitializeMetadataString(typeStruct->Name);

            typeCode = (TypeCode)(typeStruct->Attributes >> 24);
            attributes = (TypeAttributes)(typeStruct->Attributes & 0x00FFFFFF);

            // Declaring Type
            if (typeStruct->DeclaringType != null)
            {
                RuntimeTypeHandle declaringHandle = new RuntimeTypeHandle();
                ((uint**)&declaringHandle)[0] = (uint*)typeStruct->DeclaringType;
                declaringTypeHandle = declaringHandle;
            }

            // Element Type
            if ((*typeStruct).ElementType != null)
            {
                RuntimeTypeHandle elementHandle = new RuntimeTypeHandle();
                ((uint**)&elementHandle)[0] = (uint*)typeStruct->ElementType;
                elementTypeHandle = elementHandle;
            }
        }
开发者ID:Zahovay,项目名称:MOSA-Project,代码行数:29,代码来源:RuntimeType.cs

示例2: GetRTypeAttributes

        public static RTypeAttributes GetRTypeAttributes(TypeAttributes attrs, bool isValueType)
        {
            RTypeAttributes rAttrs = 0;
            TypeAttributes visibility = attrs & TypeAttributes.VisibilityMask;
            if (visibility == TypeAttributes.NotPublic)
            {
                rAttrs |= RTypeAttributes.Private;
            }
            else if (visibility == TypeAttributes.Public)
            {
                rAttrs |= RTypeAttributes.Public;
            }

            TypeAttributes classSemantics = attrs & TypeAttributes.ClassSemanticsMask;
            if (classSemantics == TypeAttributes.Class && !isValueType)
            {
                rAttrs |= RTypeAttributes.Class;
            }
            else if (classSemantics == TypeAttributes.Interface)
            {
                rAttrs |= RTypeAttributes.Interface;
            }

            if ((attrs & TypeAttributes.Sealed) != 0)
            {
                rAttrs |= RTypeAttributes.Sealed;
            }

            return rAttrs;
        }
开发者ID:dubik,项目名称:csharprpp,代码行数:30,代码来源:RTypeUtils.cs

示例3: CreateTypeBuilder

		private static TypeBuilder CreateTypeBuilder(AbstractTypeEmitter maintype, string name, TypeAttributes attributes, Type baseType, Type[] interfaces)
		{
			return maintype.TypeBuilder.DefineNestedType(
				name,
				attributes,
				baseType, interfaces);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:7,代码来源:NestedClassEmitter.cs

示例4: MakeArrayType_Int_Three

 public void MakeArrayType_Int_Three(TypeAttributes attributes)
 {
     TypeBuilder type = Helpers.DynamicType(attributes);
     Type arrayType = type.MakeArrayType(3);
     Assert.Equal(typeof(Array), arrayType.GetTypeInfo().BaseType);
     Assert.Equal("TestType[,,]", arrayType.Name);
 }
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:TypeBuilderMakeArrayType.cs

示例5: TypeDefinition

 public TypeDefinition(string @namespace, string name, TypeAttributes attributes, TypeReference baseType, uint fieldList, uint methodList)
     : base(new MetaDataRow((uint)attributes, 0U, 0U, 0U, fieldList, methodList))
 {
     this._namespace = @namespace;
     this._name = name;
     this._baseType = baseType;
 }
开发者ID:Rex-Hays,项目名称:GNIDA,代码行数:7,代码来源:TypeDefinition.cs

示例6: Type

        private static Type Type(
            string name, Type[] interfaces, MemberDefinition[] memberDefinitions,
            TypeAttributes typeAttributes, Type baseType = null)
        {
            if (name == null) throw new ArgumentNullException("name");
            if (interfaces == null) throw new ArgumentNullException("interfaces");
            if (memberDefinitions == null) throw new ArgumentNullException("memberDefinitions");

            var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                new AssemblyName(name), AssemblyBuilderAccess.Run);

            var moduleBuilder = assemblyBuilder.DefineDynamicModule("MainModule");

            var typeBuilder = moduleBuilder.DefineType(name, typeAttributes, baseType, interfaces);

            var fields = new List<FieldBuilder>();

            foreach (var definition in memberDefinitions.OrderBy(d => d is ConstructorDefinition))
            {
                definition.EmitTo(typeBuilder, fields);
            }

            if (baseType != typeof(ValueType)
                && !memberDefinitions.Any(d => d is ConstructorDefinition))
            {
                Define.Constructor().EmitTo(typeBuilder, fields);
            }

            return typeBuilder.CreateType();
        }
开发者ID:RockFramework,项目名称:Rock.Core,代码行数:30,代码来源:Create.cs

示例7: MakePointerType

 public void MakePointerType(TypeAttributes attributes)
 {
     TypeBuilder type = Helpers.DynamicType(attributes);
     Type arrayType = type.MakePointerType();
     Assert.Equal(typeof(Array), arrayType.GetTypeInfo().BaseType);
     Assert.Equal("TestType*", arrayType.Name);
 }
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:TypeBuilderMakePointerType.cs

示例8: StructureBuilder

	public StructureBuilder (NamespaceBuilder ns, CodeLinePragma loc, TypeAttributes attr) 
	    : base (BundleManagerBase.DefaultStructureClass, ns, loc, attr)
	{
	    BaseClass = new UserType (typeof (StructureTemplate));

	    ns.SetUserParams (this);
	}
开发者ID:emtees,项目名称:old-code,代码行数:7,代码来源:StructureBuilder.cs

示例9: Class

 public static CodeTypeDeclaration Class(string className, TypeAttributes attributes)
 {
     return new CodeTypeDeclaration(className)
     {
         TypeAttributes = attributes
     };
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:7,代码来源:Class.cs

示例10: DefineNestedType

        public void DefineNestedType(string name, TypeAttributes attributes, Type parent, PackingSize packingSize, int typesize, Type[] implementedInterfaces)
        {
            bool isDefaultImplementedInterfaces = implementedInterfaces?.Length == 0;
            bool isDefaultPackingSize = packingSize == PackingSize.Unspecified;
            bool isDefaultSize = typesize == 0;
            bool isDefaultParent = parent == null;
            bool isDefaultAttributes = attributes == TypeAttributes.NestedPrivate;

            Action<TypeBuilder, TypeBuilder> verify = (type, declaringType) =>
            {
                bool allowsNullParent = attributes.HasFlag(TypeAttributes.Abstract) && attributes.HasFlag(TypeAttributes.ClassSemanticsMask);
                Type baseType = allowsNullParent ? parent : (parent ?? typeof(object));
                Helpers.VerifyType(type, declaringType.Module, declaringType, name, attributes, baseType, typesize, packingSize, implementedInterfaces);
            };

            if (isDefaultImplementedInterfaces)
            {
                if (isDefaultSize && isDefaultPackingSize)
                {
                    if (isDefaultParent)
                    {
                        if (isDefaultAttributes)
                        {
                            // Use DefineNestedType(string)
                            TypeBuilder type1 = Helpers.DynamicType(TypeAttributes.Public);
                            verify(type1.DefineNestedType(name), type1);
                        }
                        // Use DefineNestedType(string, TypeAttributes)
                        TypeBuilder type2 = Helpers.DynamicType(TypeAttributes.Public);
                        verify(type2.DefineNestedType(name, attributes), type2);
                    }
                    // Use DefineNestedType(string, TypeAttributes, Type)
                    TypeBuilder type3 = Helpers.DynamicType(TypeAttributes.Public);
                    verify(type3.DefineNestedType(name, attributes, parent), type3);
                }
                else if (isDefaultSize)
                {
                    // Use DefineNestedType(string, TypeAttributes, Type, PackingSize)
                    TypeBuilder type4 = Helpers.DynamicType(TypeAttributes.Public);
                    verify(type4.DefineNestedType(name, attributes, parent, packingSize), type4);
                }
                else if (isDefaultPackingSize)
                {
                    // Use DefineNestedType(string, TypeAttributes, Type, int)
                    TypeBuilder type5 = Helpers.DynamicType(TypeAttributes.Public);
                    verify(type5.DefineNestedType(name, attributes, parent, typesize), type5);
                }
                // Use DefineNestedType(string, TypeAttributes, Type, PackingSize, int);
                TypeBuilder type6 = Helpers.DynamicType(TypeAttributes.Public);
                verify(type6.DefineNestedType(name, attributes, parent, packingSize, typesize), type6);
            }
            else
            {
                // Use DefineNestedType(string, TypeAttributes, Type, Type[])
                Assert.True(isDefaultSize && isDefaultPackingSize); // Sanity check
                TypeBuilder type7 = Helpers.DynamicType(TypeAttributes.Public);
                verify(type7.DefineNestedType(name, attributes, parent, implementedInterfaces), type7);
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:59,代码来源:TypeBuilderDefineNestedType.cs

示例11: TheResult

	    public TheResult (string name, NamespaceBuilder ns, string ename, CodeLinePragma loc, TypeAttributes attr)
		: base (name, ns, loc, attr)
	    {
		etype = new UserType (ename);

		BaseClass = new UserType (typeof (EnumResult<>));
		BaseClass.AddTypeArgument (etype);
	    }
开发者ID:emtees,项目名称:old-code,代码行数:8,代码来源:EnumResultBuilder.cs

示例12: EnumResultBuilder

	public EnumResultBuilder (string name, NamespaceBuilder ns, CodeLinePragma loc, TypeAttributes attr)
	{
	    if (name == null)
		throw new ArgumentNullException ();
	    
	    enumer = new TheEnum (name, ns, loc, attr);
	    result = new TheResult (name + "Result", ns, name, loc, attr);
	}
开发者ID:emtees,项目名称:old-code,代码行数:8,代码来源:EnumResultBuilder.cs

示例13: InitializeType

		private void InitializeType(XmlNode ruleInstance)
		{
			string modifierstring = ruleInstance.Attributes["modifiers"].Value;
			foreach (string s in modifierstring.Split(','))
				this.typeAttributes = 
					this.typeAttributes 
					| (TypeAttributes)Enum.Parse(typeof(TypeAttributes), s.Trim(), true);
		}
开发者ID:codetuner,项目名称:Arebis.Common,代码行数:8,代码来源:ModifierMatchingRule.cs

示例14: Initialize

 public void Initialize(string name, TypeAttributes attr, BlockStructure block = null, Type info = null)
 {
     Name = name;
     Attributes = attr;
     Block = block;
     AppendChild(Block);
     Info = info;
 }
开发者ID:B-head,项目名称:Dreit-prototype,代码行数:8,代码来源:TypeStructure.cs

示例15: CreateType

        public void CreateType(TypeAttributes attributes)
        {
            TypeBuilder type = Helpers.DynamicType(attributes);
            Type createdType = type.CreateTypeInfo().AsType();
            Assert.Equal(type.Name, createdType.Name);

            Assert.Equal(type.CreateTypeInfo(), type.CreateTypeInfo());
        }
开发者ID:dotnet,项目名称:corefx,代码行数:8,代码来源:TypeBuilderCreateType.cs


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