Guest User

Untitled

a guest
Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #-------------------------------------------------------------
  2. # Creates the class type and returns it to the calling method.
  3. # Any fields, properties, or methods will need the object. If
  4. # no interface is need the simple call is made creating the
  5. # type object as a Public class. The first two parameters are
  6. # the same in both DefineType calls. In the cases where we are
  7. # implementing an interface we need to pass in the Object
  8. # constructor and the interface type we are implementing.
  9. #-------------------------------------------------------------
  10. def define_class(class_name, interface=nil)
  11. if interface.nil?
  12. @mod_builder.DefineType("#{@namespace}.#{class_name}",
  13. TypeAttributes.Public)
  14. else
  15. types = System::Collections::Generic::List.of(Type).new
  16. types.add interface
  17.  
  18. tb = @mod_builder.DefineType("#{@namespace}.#{class_name}",
  19. TypeAttributes.Public,
  20. System::Object.to_clr_type,
  21. types.ToArray)
  22.  
  23. tb
  24. end
  25. end
Add Comment
Please, Sign In to add comment