3 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
5 // Permission is hereby granted, free of charge, to any person obtaining
6 // a copy of this software and associated documentation files (the
7 // "Software"), to deal in the Software without restriction, including
8 // without limitation the rights to use, copy, modify, merge, publish,
9 // distribute, sublicense, and/or sell copies of the Software, and to
10 // permit persons to whom the Software is furnished to do so, subject to
11 // the following conditions:
13 // The above copyright notice and this permission notice shall be
14 // included in all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 // System.Reflection.Emit/EnumBuilder.cs
29 // Paolo Molaro (lupus@ximian.com)
31 // (C) 2001 Ximian, Inc. http://www.ximian.com
35 using System.Reflection;
36 using System.Reflection.Emit;
37 using System.Globalization;
38 using System.Runtime.CompilerServices;
40 namespace System.Reflection.Emit {
41 public sealed class EnumBuilder : Type {
42 CustomAttributeBuilder[] cattrs;
44 public override Assembly Assembly {
47 public override string AssemblyQualifiedName {
50 public override Type BaseType {
53 public override Type DeclaringType {
56 public override string FullName {
59 public override Guid GUID {
60 get { return Guid.Empty; }
62 public override Module Module {
65 public override string Name {
68 public override string Namespace {
71 public override Type ReflectedType {
74 public override RuntimeTypeHandle TypeHandle {
75 get { return new RuntimeTypeHandle (); }
77 public TypeToken TypeToken {
78 get { return new TypeToken (); }
80 public FieldBuilder UnderlyingField {
83 public override Type UnderlyingSystemType {
86 /* no need to override
87 public override MemberTypes MemberType {
88 get {return MemberTypes.TypeInfo;}
92 internal EnumBuilder (ModuleBuilder mb, string name, TypeAttributes visibility, Type underlyingType)
96 public Type CreateType ()
101 public FieldBuilder DefineLiteral (string literalName, object literalValue)
105 protected override TypeAttributes GetAttributeFlagsImpl ()
107 return (TypeAttributes)0;
110 protected override ConstructorInfo GetConstructorImpl (
111 BindingFlags bindingAttr, Binder binder, CallingConventions cc,
112 Type[] types, ParameterModifier[] modifiers)
117 public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr)
122 public override object[] GetCustomAttributes(bool inherit)
127 public override object[] GetCustomAttributes(Type attributeType, bool inherit)
132 public override Type GetElementType()
134 throw new NotSupportedException ();
137 public override EventInfo GetEvent( string name, BindingFlags bindingAttr)
142 public override EventInfo[] GetEvents()
147 public override EventInfo[] GetEvents( BindingFlags bindingAttr)
152 public override FieldInfo GetField( string name, BindingFlags bindingAttr)
157 public override FieldInfo[] GetFields( BindingFlags bindingAttr)
162 public override Type GetInterface( string name, bool ignoreCase)
167 public override InterfaceMapping GetInterfaceMap( Type interfaceType)
169 throw new NotImplementedException ();
172 public override Type[] GetInterfaces()
177 public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr)
182 public override MemberInfo[] GetMembers( BindingFlags bindingAttr)
187 protected override MethodInfo GetMethodImpl (
188 string name, BindingFlags bindingAttr, Binder binder,
189 CallingConventions callConvention, Type[] types,
190 ParameterModifier[] modifiers)
196 public override MethodInfo[] GetMethods( BindingFlags bindingAttr)
201 public override Type GetNestedType( string name, BindingFlags bindingAttr)
206 public override Type[] GetNestedTypes( BindingFlags bindingAttr)
211 public override PropertyInfo[] GetProperties( BindingFlags bindingAttr)
216 protected override PropertyInfo GetPropertyImpl (
217 string name, BindingFlags bindingAttr, Binder binder,
218 Type returnType, Type[] types,
219 ParameterModifier[] modifiers)
224 protected override bool HasElementTypeImpl()
226 throw new NotSupportedException ();
229 public override object InvokeMember (
230 string name, BindingFlags invokeAttr, Binder binder,
231 object target, object[] args,
232 ParameterModifier[] modifiers, CultureInfo culture,
233 string[] namedParameters)
238 protected override bool IsArrayImpl()
243 protected override bool IsByRefImpl()
248 protected override bool IsCOMObjectImpl()
253 protected override bool IsPointerImpl()
258 protected override bool IsPrimitiveImpl()
263 protected override bool IsValueTypeImpl()
268 public override bool IsDefined( Type attributeType, bool inherit)
273 public void SetCustomAttribute( CustomAttributeBuilder customBuilder)
275 if (cattrs != null) {
276 CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
277 cattrs.CopyTo (new_array, 0);
278 new_array [cattrs.Length] = customBuilder;
281 cattrs = new CustomAttributeBuilder [1];
282 cattrs [0] = customBuilder;
286 public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute)
288 SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
291 #if NET_2_0 || BOOTSTRAP_NET_2_0
292 public override Type[] GetGenericArguments ()
294 throw new NotImplementedException ();
297 public override bool HasGenericArguments {
299 throw new NotImplementedException ();
303 public override bool ContainsGenericParameters {
305 throw new NotImplementedException ();
309 public override bool IsGenericParameter {
311 throw new NotImplementedException ();
315 public override int GenericParameterPosition {
317 throw new NotImplementedException ();
321 public override MethodInfo DeclaringMethod {
323 throw new NotImplementedException ();