Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # All of the handle* functions are defined elsewhere in the code.
  2. # Calls to dispatcher are made like `TYPE_HANDLERS[type(dat)](name, dat)`
  3. TYPE_HANDLERS = {dict: handleDict, list: handleList, str: handleStr, int: handleInt}
  4.  
  5. Private Delegate Function handleDelegate(ByVal name As String, ByVal dat As Object) As String
  6. Function ParseDataIntoXML(ByVal name As String, ByVal dat As Object) As String
  7. Dim myDelegate As handleDelegate
  8. Select Case dat.GetType
  9. Case GetType(Dictionary(Of Object, Object))
  10. myDelegate = AddressOf handleDict
  11. Case GetType(ArrayList)
  12. myDelegate = AddressOf handleList
  13. Case GetType(String)
  14. myDelegate = AddressOf handleStr
  15. Case GetType(Integer)
  16. myDelegate = AddressOf handleInt
  17. End Select
  18.  
  19. Return myDelegate(name, dat)
  20. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement