Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------
- # Creates the class type and returns it to the calling method.
- # Any fields, properties, or methods will need the object. If
- # no interface is need the simple call is made creating the
- # type object as a Public class. The first two parameters are
- # the same in both DefineType calls. In the cases where we are
- # implementing an interface we need to pass in the Object
- # constructor and the interface type we are implementing.
- #-------------------------------------------------------------
- def define_class(class_name, interface=nil)
- if interface.nil?
- @mod_builder.DefineType("#{@namespace}.#{class_name}",
- TypeAttributes.Public)
- else
- types = System::Collections::Generic::List.of(Type).new
- types.add interface
- tb = @mod_builder.DefineType("#{@namespace}.#{class_name}",
- TypeAttributes.Public,
- System::Object.to_clr_type,
- types.ToArray)
- tb
- end
- end
Add Comment
Please, Sign In to add comment