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


C# FieldAttributes类代码示例

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


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

示例1: FieldBuilder

        internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, FieldAttributes attributes)
        {
            if (fieldName==null)
                throw new ArgumentNullException("fieldName");
			if (fieldName.Length == 0)
				throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName");
            if (fieldName[0] == '\0')
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName");
            if (type==null)
                throw new ArgumentNullException("type");
            if (type == SystemVoid)
                throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType"));
    
            m_fieldName = fieldName;
            m_typeBuilder = typeBuilder;
            m_fieldType = type;
            m_Attributes = attributes;
            
            SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module);
            sigHelp.AddArgument(type);
    
            int sigLength;
            byte[] signature = sigHelp.InternalGetSignature(out sigLength);
            
            m_tkField = new FieldToken(TypeBuilder.InternalDefineField(
                typeBuilder.TypeToken.Token, 
                fieldName, 
                signature, 
                sigLength, 
                attributes, 
                m_typeBuilder.Module), type);
        }
开发者ID:ArildF,项目名称:masters,代码行数:32,代码来源:fieldbuilder.cs

示例2: FieldDefinition

 public FieldDefinition(string name, TypeReference fieldType,
     FieldAttributes attrs)
     : base(name, fieldType)
 {
     m_hasInfo = false;
     m_attributes = attrs;
 }
开发者ID:leftouterjoin,项目名称:loj-prj1,代码行数:7,代码来源:FieldDefinition.cs

示例3: FieldWeaver

 public FieldWeaver(TypeBuilder typeBuilder, Type type, string fieldName = null, FieldAttributes? fieldAttributes = null)
 {
     FieldType = type;
     this.fieldName = fieldName;
     this.typeBuilder = typeBuilder;
     this.fieldAttributes = fieldAttributes ?? FieldAttributes.Private;
 }
开发者ID:sagifogel,项目名称:NCop,代码行数:7,代码来源:FieldWeaver.cs

示例4: FieldKey

 public FieldKey(TypeKey typeKey, string type, string name, FieldAttributes fieldAttributes)
 {
     this.typeKey = typeKey;
     this.type = type;
     this.name = name;
     this.fieldAttributes = fieldAttributes;
 }
开发者ID:chinshou,项目名称:Obfuscar,代码行数:7,代码来源:FieldKey.cs

示例5: RenderFieldAttributes

		void RenderFieldAttributes (FieldAttributes source, FieldAttributes target, ApiChange change)
		{
			// the visibility values are the same for MethodAttributes and FieldAttributes, so just use the same method.
			RenderVisibility ((MethodAttributes) source, (MethodAttributes) target, change);
			// same for the static flag
			RenderStatic ((MethodAttributes) source, (MethodAttributes) target, change);

			var srcLiteral = (source & FieldAttributes.Literal) != 0;
			var tgtLiteral = (target & FieldAttributes.Literal) != 0;

			if (srcLiteral) {
				if (tgtLiteral) {
					change.Append ("const ");
				} else {
					change.AppendRemoved ("const", true).Append (" ");
				}
			} else if (tgtLiteral) {
				change.AppendAdded ("const", true).Append (" ");
			}

			var srcInitOnly = (source & FieldAttributes.InitOnly) != 0;
			var tgtInitOnly = (target & FieldAttributes.InitOnly) != 0;
			if (srcInitOnly) {
				if (tgtInitOnly) {
					change.Append ("readonly ");
				} else {
					change.AppendRemoved ("readonly", false).Append (" ");
				}
			} else if (tgtInitOnly) {
				change.AppendAdded ("readonly", true).Append (" ");
			}
		}
开发者ID:kumpera,项目名称:mono,代码行数:32,代码来源:FieldComparer.cs

示例6: FieldBuilder

 internal FieldBuilder(TypeBuilder typeBuilder, string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
 {
     int num;
     if (fieldName == null)
     {
         throw new ArgumentNullException("fieldName");
     }
     if (fieldName.Length == 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName");
     }
     if (fieldName[0] == '\0')
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName");
     }
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     if (type == typeof(void))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType"));
     }
     this.m_fieldName = fieldName;
     this.m_typeBuilder = typeBuilder;
     this.m_fieldType = type;
     this.m_Attributes = attributes & ~FieldAttributes.ReservedMask;
     SignatureHelper fieldSigHelper = SignatureHelper.GetFieldSigHelper(this.m_typeBuilder.Module);
     fieldSigHelper.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers);
     byte[] signature = fieldSigHelper.InternalGetSignature(out num);
     this.m_fieldTok = TypeBuilder.DefineField(this.m_typeBuilder.GetModuleBuilder().GetNativeHandle(), typeBuilder.TypeToken.Token, fieldName, signature, num, this.m_Attributes);
     this.m_tkField = new FieldToken(this.m_fieldTok, type);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:FieldBuilder.cs

示例7: AddNewField

 internal virtual JSVariableField AddNewField(string name, object value, FieldAttributes attributeFlags)
 {
     JSVariableField field = this.CreateField(name, attributeFlags, value);
     this.name_table[name] = field;
     this.field_table.Add(field);
     return field;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ActivationObject.cs

示例8: JSWithField

 internal JSWithField(string name, FieldAttributes attributes)
     : base(name, null, attributes)
 {
     // with-fields cannot be crunced because they might
     // need to reference a property on the with object
     CanCrunch = false;
 }
开发者ID:nuxleus,项目名称:ajaxmin,代码行数:7,代码来源:jswithfield.cs

示例9: FieldBuilder

        [System.Security.SecurityCritical]  // auto-generated
        internal FieldBuilder(TypeBuilder typeBuilder, String fieldName, Type type, 
            Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
        {
            if (fieldName == null)
                throw new ArgumentNullException("fieldName");

            if (fieldName.Length == 0)
                throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "fieldName");

            if (fieldName[0] == '\0')
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "fieldName");

            if (type == null)
                throw new ArgumentNullException("type");

            if (type == typeof(void))
                throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType"));
            Contract.EndContractBlock();

            m_fieldName = fieldName;
            m_typeBuilder = typeBuilder;
            m_fieldType = type;
            m_Attributes = attributes & ~FieldAttributes.ReservedMask;
            
            SignatureHelper sigHelp = SignatureHelper.GetFieldSigHelper(m_typeBuilder.Module);
            sigHelp.AddArgument(type, requiredCustomModifiers, optionalCustomModifiers);

            int sigLength;
            byte[] signature = sigHelp.InternalGetSignature(out sigLength);
            
            m_fieldTok = TypeBuilder.DefineField(m_typeBuilder.GetModuleBuilder().GetNativeHandle(),
                typeBuilder.TypeToken.Token, fieldName, signature, sigLength, m_Attributes);

            m_tkField = new FieldToken(m_fieldTok, type);
        }
开发者ID:l1183479157,项目名称:coreclr,代码行数:36,代码来源:FieldBuilder.cs

示例10: EnumDeclaration

 internal EnumDeclaration(Context context, IdentifierLiteral id, TypeExpression baseType, Block body, FieldAttributes attributes, CustomAttributeList customAttributes) : base(context, id, new TypeExpression(new ConstantWrapper(Typeob.Enum, null)), new TypeExpression[0], body, attributes, false, false, true, false, customAttributes)
 {
     this.baseType = (baseType != null) ? baseType : new TypeExpression(new ConstantWrapper(Typeob.Int32, null));
     base.needsEngine = false;
     base.attributes &= TypeAttributes.NestedFamORAssem;
     TypeExpression expression = new TypeExpression(new ConstantWrapper(base.classob, base.context));
     AST ast = new ConstantWrapper(-1, null);
     AST ast2 = new ConstantWrapper(1, null);
     JSMemberField[] fields = base.fields;
     for (int i = 0; i < fields.Length; i++)
     {
         FieldInfo info = fields[i];
         JSVariableField field = (JSVariableField) info;
         field.attributeFlags = FieldAttributes.Literal | FieldAttributes.Static | FieldAttributes.Public;
         field.type = expression;
         if (field.value == null)
         {
             field.value = ast = new Plus(ast.context, ast, ast2);
         }
         else
         {
             ast = (AST) field.value;
         }
         field.value = new DeclaredEnumValue(field.value, field.Name, base.classob);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:EnumDeclaration.cs

示例11: CreateField

 protected override JSVariableField CreateField(String name, FieldAttributes attributeFlags, Object value){
   if (!(this.parent is ActivationObject))
     return base.CreateField(name, attributeFlags, value);
   JSVariableField field = ((ActivationObject)this.parent).AddNewField(name+":"+this.scopeId, value, attributeFlags);
   field.debuggerName = name;
   return field;
 }
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:blockscope.cs

示例12: FieldInfoMirror

		public FieldInfoMirror (TypeMirror parent, long id, string name, TypeMirror type, FieldAttributes attrs) : base (parent.VirtualMachine, id) {
			this.parent = parent;
			this.name = name;
			this.type = type;
			this.attrs = attrs;
			inited = true;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:FieldInfoMirror.cs

示例13: AddOverload

 internal JSMemberField AddOverload(FunctionObject func, FieldAttributes attributeFlags){
   JSMemberField last = this;
   while (last.nextOverload != null) last = last.nextOverload;
   JSMemberField f = last.nextOverload = new JSMemberField((ClassScope)this.obj, this.Name, func, attributeFlags);
   f.type = this.type;
   return f;
 }
开发者ID:ArildF,项目名称:masters,代码行数:7,代码来源:jsmemberfield.cs

示例14: DefineUninitalizedData_CreateGlobalFunctionsAlreadyCalled_ThrowsInvalidOperationException

        public void DefineUninitalizedData_CreateGlobalFunctionsAlreadyCalled_ThrowsInvalidOperationException(FieldAttributes attributes)
        {
            ModuleBuilder module = Helpers.DynamicModule();
            module.CreateGlobalFunctions();

            Assert.Throws<InvalidOperationException>(() => module.DefineUninitializedData("TestField", 1, attributes));
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:ModuleBuilderDefineUninitializedData.cs

示例15: NotSupportedException

	public virtual void DefineGlobalVariable
				(String name, FieldAttributes attributes, 
				 byte[] signature, SymAddressKind addrKind,
				 int addr1, int addr2, int addr3)
			{
				throw new NotSupportedException();
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SymWriter.cs


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