Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. Public Class PropertyAccessor
  2.  
  3. Private ReadOnly _canRead As Boolean
  4. Private ReadOnly _canWrite As Boolean
  5. Private ReadOnly _type As Type
  6. Private ReadOnly _name As String
  7.  
  8. Public ReadOnly Property CanRead As Boolean
  9. Get
  10. Return _canRead
  11. End Get
  12. End Property
  13. Public ReadOnly Property CanWrite As Boolean
  14. Get
  15. Return _canWrite
  16. End Get
  17. End Property
  18. Public ReadOnly Property PropertyType As Type
  19. Get
  20. Return _type
  21. End Get
  22. End Property
  23. Public ReadOnly Property Name As String
  24. Get
  25. Return _name
  26. End Get
  27. End Property
  28.  
  29. Public Sub New(ByRef inboundProperty As PropertyInfo)
  30. _canRead = inboundProperty.CanRead
  31. _canWrite = inboundProperty.CanWrite
  32. _type = inboundProperty.PropertyType
  33. _name = inboundProperty.Name
  34.  
  35. GenerateSetter(inboundProperty.GetSetMethod(True))
  36. GenerateGetter(inboundProperty.GetGetMethod(True))
  37. End Sub
  38.  
  39. Public Sub New(ByRef inboundField As FieldInfo)
  40. _canRead = True
  41. _canWrite = Not inboundField.IsInitOnly
  42. _type = inboundField.FieldType
  43. _name = inboundField.Name
  44.  
  45. GenerateSetter(inboundField)
  46. GenerateGetter(inboundField)
  47. End Sub
  48.  
  49. Private Sub GenerateSetter(ByRef setMethod As MethodInfo)
  50. ' Trying to write this one
  51. End Sub
  52. Private Sub GenerateGetter(ByRef getMethod As MethodInfo)
  53. ' Trying to write this one
  54. End Sub
  55. Private Sub GenerateSetter(ByRef field As FieldInfo)
  56. ' TBC
  57. End Sub
  58. Private Sub GenerateGetter(ByRef field As FieldInfo)
  59. ' TBC
  60. End Sub
  61. Public Sub [Set](ByRef instance As Object, ByRef value As Object)
  62. ' TBC
  63. End Sub
  64. Public Function [Get](ByRef instance As Object) As Object
  65. ' TBC
  66. End Function
  67. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement