3 // System.Reflection.Emit/EnumBuilder.cs
6 // Paolo Molaro (lupus@ximian.com)
8 // (C) 2001 Ximian, Inc. http://www.ximian.com
12 using System.Reflection;
13 using System.Reflection.Emit;
14 using System.Globalization;
15 using System.Runtime.CompilerServices;
17 namespace System.Reflection.Emit {
18 public sealed class EnumBuilder : Type {
19 CustomAttributeBuilder[] cattrs;
21 public override Assembly Assembly {
24 public override string AssemblyQualifiedName {
27 public override Type BaseType {
30 public override Type DeclaringType {
33 public override string FullName {
36 public override Guid GUID {
37 get {return Guid.Empty;}
39 public override Module Module {
42 public override string Name {
45 public override string Namespace {
48 public override Type ReflectedType {
51 public override RuntimeTypeHandle TypeHandle {
52 get {return new RuntimeTypeHandle ();}
54 public TypeToken TypeToken {
55 get {return new TypeToken ();}
57 public FieldBuilder UnderlyingField {
60 public override Type UnderlyingSystemType {
63 /* no need to override
64 public override MemberTypes MemberType {
65 get {return MemberTypes.TypeInfo;}
69 internal EnumBuilder (ModuleBuilder mb, string name, TypeAttributes visibility, Type underlyingType) {
71 public Type CreateType() {
74 public FieldBuilder DefineLiteral( string literalName, object literalValue) {
77 protected override TypeAttributes GetAttributeFlagsImpl() {
78 return (TypeAttributes)0;
80 protected override ConstructorInfo GetConstructorImpl( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
83 public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr) {
86 public override object[] GetCustomAttributes(bool inherit) {
89 public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
92 public override Type GetElementType() {
93 throw new NotSupportedException ();
95 public override EventInfo GetEvent( string name, BindingFlags bindingAttr) {
98 public override EventInfo[] GetEvents() {
101 public override EventInfo[] GetEvents( BindingFlags bindingAttr) {
104 public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
107 public override FieldInfo[] GetFields( BindingFlags bindingAttr) {
110 public override Type GetInterface( string name, bool ignoreCase) {
113 public override InterfaceMapping GetInterfaceMap( Type interfaceType) {
114 throw new NotImplementedException ();
116 public override Type[] GetInterfaces() {
119 public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr) {
122 public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
125 protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
130 public override MethodInfo[] GetMethods( BindingFlags bindingAttr) {
133 public override Type GetNestedType( string name, BindingFlags bindingAttr) {
136 public override Type[] GetNestedTypes( BindingFlags bindingAttr) {
139 public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
142 protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
145 protected override bool HasElementTypeImpl() {
146 throw new NotSupportedException ();
148 public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
151 protected override bool IsArrayImpl() {
154 protected override bool IsByRefImpl() {
157 protected override bool IsCOMObjectImpl() {
160 protected override bool IsPointerImpl() {
163 protected override bool IsPrimitiveImpl() {
166 protected override bool IsValueTypeImpl() {
169 public override bool IsDefined( Type attributeType, bool inherit) {
173 public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
174 if (cattrs != null) {
175 CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
176 cattrs.CopyTo (new_array, 0);
177 new_array [cattrs.Length] = customBuilder;
180 cattrs = new CustomAttributeBuilder [1];
181 cattrs [0] = customBuilder;
184 public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
185 SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));