4 // System.Reflection.Emit/FieldBuilder.cs
7 // Paolo Molaro (lupus@ximian.com)
9 // (C) 2001 Ximian, Inc. http://www.ximian.com
13 using System.Reflection;
14 using System.Reflection.Emit;
15 using System.Globalization;
16 using System.Runtime.CompilerServices;
18 namespace System.Reflection.Emit {
19 public sealed class FieldBuilder : FieldInfo {
20 private FieldAttributes attrs;
23 private object def_value;
25 private int table_idx;
26 internal TypeBuilder typeb;
28 internal FieldBuilder (TypeBuilder tb, string fieldName, Type type, FieldAttributes attributes) {
34 table_idx = tb.module.assemblyb.get_next_table_index (0x04, true);
37 public override FieldAttributes Attributes {
40 public override Type DeclaringType {
43 public override RuntimeFieldHandle FieldHandle {
44 get {return new RuntimeFieldHandle();}
46 public override Type FieldType {
49 public override string Name {
52 public override Type ReflectedType {
56 public override object[] GetCustomAttributes(bool inherit) {
59 public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
62 public FieldToken GetToken() {
63 return new FieldToken (0x04000000 | table_idx);
65 public override object GetValue(object obj) {
68 public override bool IsDefined( Type attributeType, bool inherit) {
71 public void SetConstant( object defaultValue) {
72 def_value = defaultValue;
74 public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
76 public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
78 public void SetMarshal( UnmanagedMarshal unmanagedMarshal) {
80 public void SetOffset( int iOffset) {
83 public override void SetValue( object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture) {