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

C# FieldAttributes类代码示例

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

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



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


示例16: CilRuntimeField

 /// <summary>
 /// Initializes a new instance of the <see cref="CilRuntimeField"/> class.
 /// </summary>
 /// <param name="module">The module.</param>
 /// <param name="name">The name.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="token">The token.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="rva">The rva.</param>
 /// <param name="declaringType">Type of the declaring.</param>
 /// <param name="attributes">The attributes.</param>
 public CilRuntimeField(ITypeModule module, string name, FieldSignature signature, Token token, uint offset, uint rva, RuntimeType declaringType, FieldAttributes attributes)
     : base(module, token, declaringType)
 {
     this.Name = name;
     this.Signature = signature;
     base.Attributes = attributes;
     base.RVA = rva;
 }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:19,代码来源:CilRuntimeField.cs


示例17: DefineUnitializedData_InvalidSize_ThrowsArgumentException

 public void DefineUnitializedData_InvalidSize_ThrowsArgumentException(FieldAttributes attributes)
 {
     ModuleBuilder module = Helpers.DynamicModule();
     foreach (int size in new int[] { -1, 0, 0x003f0000, 0x003f0000 + 1 })
     {
         Assert.Throws<ArgumentException>(null, () => module.DefineUninitializedData("TestField", size, attributes));
     }
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:8,代码来源:ModuleBuilderDefineUninitializedData.cs


示例18:

	public virtual void DefineLocalVariable
				(String name, FieldAttributes attributes, 
				 byte[] signature, SymAddressKind addrKind, 
				 int addr1, int addr2, int addr3, 
				 int startOffset, int endOffset)
			{
				// Nothing to do here.
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:SymWriter.cs


示例19: TestWithStaticAndPublic

 public void TestWithStaticAndPublic(FieldAttributes attributes)
 {
     ModuleBuilder module = Helpers.DynamicModule();
     FieldBuilder field = module.DefineInitializedData("MyField", new byte[] { 01, 00, 01 }, attributes);
     Assert.True(field.IsStatic);
     Assert.Equal((attributes & FieldAttributes.Public) != 0 , field.IsPublic);
     Assert.Equal((attributes & FieldAttributes.Private) != 0, field.IsPrivate);
     Assert.Equal(field.Name, "MyField");
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:9,代码来源:ModuleBuilderDefineInitializedData.cs


示例20: FieldMetadata

 public FieldMetadata(
     string name, 
     Type fieldType, 
     FieldAttributes fieldAttributes)
     : base(name)
 {
     _fieldType = fieldType;
     _fieldAttributes = fieldAttributes;
 }
开发者ID:bradleyjford,项目名称:inception,代码行数:9,代码来源:FieldMetadata.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# FieldClass类代码示例发布时间:2022-05-24
下一篇:
C# Field类代码示例发布时间: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