IDL Complex Types
enum The CORBA enum is represented by a sequence of integers in VB.  The enum members is numbered successively from zero.  It maps to two VB's classes as follow:
// CORBA IDL
enum  colorT{green,blue,red,black};
e.g.
ColorT
colorTHelper
// VB 
Imports System

Namespace demo.unions
   '
   ' Enum definition : colorT
   '
   ' @author TomORB VB Native Compiler 1.0rc1
   '
   <Serializable()> _
   Public NotInheritable Class colorT
      Implements Org.Omg.CORBA.Portable.IDLEntity
      ' 
      ' Enum member green value 
      ' 
      Public Shared _green As Integer = 0

      ' 
      ' Enum member green
      ' 
      Public Shared green As colorT = New colorT(_green)

      ' 
      ' Enum member blue value 
      ' 
      Public Shared _blue As Integer = 1

      ' 
      ' Enum member blue
      ' 
      Public Shared blue As colorT = New colorT(_blue)

      ' 
      ' Enum member red value 
      ' 
      Public Shared _red As Integer = 2

      ' 
      ' Enum member red
      ' 
      Public Shared red As colorT = New colorT(_red)

      ' 
      ' Enum member black value 
      ' 
      Public Shared _black As Integer = 3

      ' 
      ' Enum member black
      ' 
      Public Shared black As colorT = New colorT(_black)

      '
      ' Internal member value 
      '
      Private _colorT_value As Integer

      '
      ' private constructor
      ' @param  the enum value for this new member
      '
      Private Sub New(value As Integer)
         _colorT_value = value
      End Sub

      '
      ' Maintains singleton property for serialized enums.
      '
      Public Function ReadResolve() As System.Object
         Return From_Int( Value() );
      End Function

      '
      ' Return the internal member value
      ' @return the member value
      '
      Public Function Value() As Integer
         Return _colorT_value
      End Function

      ' 
      ' Return a enum member from its value
      ' @param  an enum value
      ' @return an enum member
      ' 
      Public Shared Function From_Int(value As Integer) As colorT
         Select Case value
         Case 0
            Return green
         Case 1
            Return blue
         Case 2
            Return red
         Case 3
            Return black
         End Select
         Throw New Org.Omg.CORBA.BAD_OPERATION()
      End Function

      ' 
      ' Return a string representation
      ' @return a string representation of the enumeration
      ' 
      Public Overrides Function ToString() As String
         Select Case _colorT_value
         case 0
            return "green"
         case 1
            return "blue"
         case 2
            return "red"
         case 3
            return "black"
         End Select
         Throw New Org.Omg.CORBA.BAD_OPERATION()
         End Function

   End Class
End Namespace


Namespace demo.unions
   ' 
   ' Helper class for : colorT
   '  
   ' @author TomORB VB Native Compiler 1.0rc1
   ' 
   Public Class colorTHelper
      '
      ' Insert colorT into an any
      ' param name="a"an any
      ' param name="t"colorT value
      '
      Public Shared Sub Insert(a As Org.Omg.CORBA.Any, t As demo.unions.colorT)
         a.Type(Type())
         Write(a.Create_Output_Stream(),t)
      End Sub

      '
      ' Extract colorT from an any
      ' @param a an any
      ' @return the extracted colorT value
      '
      Public Shared Function Extract(a As Org.Omg.CORBA.Any) As demo.unions.colorT
         If Not(a.Type().Equal(Type())) Then
            Throw New Org.Omg.CORBA.MARSHAL()
         End If
         Return Read(a.Create_Input_Stream())
      End Function

      '
      ' Internal TypeCode value
      '
      Private Shared _tc As Org.Omg.CORBA.TypeCode = Nothing

      '
      ' Return the colorT TypeCode
      ' @return a TypeCode
      '
      Public Shared Function Type() As Org.Omg.CORBA.TypeCode
         If _tc Is Nothing Then
            Dim orb As Org.Omg.CORBA.ORB = Org.Omg.CORBA.ORB.Init()
            Dim _members() As String = New String(4){}
            _members(0) = "green"
            _members(1) = "blue"
            _members(2) = "red"
            _members(3) = "black"
            _tc = orb.Create_Enum_TC(Id(),"colorT",_members)
         End If
         Return _tc
      End Function

      '
      ' Return the colorT IDL ID
      ' @return an ID
      '
      Public Shared Function Id() As String
         Return _id
      End Function

      Private Shared _id As String = "IDL:demo/unions/colorT:1.0"

      '
      ' Read colorT from a marshalled stream
      ' @param istream the input stream
      ' @return the readed colorT value
      '
      Public Shared Function Read(istream As Org.Omg.CORBA.Portable.InputStream) 
                    As demo.unions.colorT
                    
         Return colorT.From_Int( Convert.ToInt32(istream.Read_ULong()))
      End Function

      '
      ' Write colorT into a marshalled stream
      ' @param ostream the output stream
      ' @param value colorT value
      '
      Public Shared Sub Write(ostream As Org.Omg.CORBA.Portable.OutputStream, 
                              value As demo.unions.colorT)
         ostream.Write_ULong( Convert.ToUInt32(value.Value()))
      End Sub

   End Class

End Namespace