本文整理汇总了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);
}
示例2: FieldDefinition
public FieldDefinition(string name, TypeReference fieldType,
FieldAttributes attrs)
: base(name, fieldType)
{
m_hasInfo = false;
m_attributes = attrs;
}
示例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;
}
示例4: FieldKey
public FieldKey(TypeKey typeKey, string type, string name, FieldAttributes fieldAttributes)
{
this.typeKey = typeKey;
this.type = type;
this.name = name;
this.fieldAttributes = fieldAttributes;
}
示例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 (" ");
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例15: NotSupportedException
public virtual void DefineGlobalVariable
(String name, FieldAttributes attributes,
byte[] signature, SymAddressKind addrKind,
int addr1, int addr2, int addr3)
{
throw new NotSupportedException();
}