Created
August 16, 2012 18:53
-
-
Save chrissie1/3372616 to your computer and use it in GitHub Desktop.
this should fail. In old VB.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Dynamic | |
Module Module1 | |
Sub Main() | |
Dim c2 As Object = New C | |
Dim db2 As Object = New D | |
c2.Join(db2.Address) | |
End Sub | |
End Module | |
Class C : Inherits DynamicObject | |
Public Overrides Function TryInvokeMember(binder As System.Dynamic.InvokeMemberBinder, args() As Object, ByRef result As Object) As Boolean | |
If binder.Name = "Join" Then | |
result = args(0) & args(0) | |
Return True | |
End If | |
Return False | |
End Function | |
End Class | |
Class D : Inherits DynamicObject | |
Public Overrides Function TryGetMember(binder As System.Dynamic.GetMemberBinder, ByRef result As Object) As Boolean | |
If binder.Name = "Address" Then | |
result = "addr" | |
Return True | |
End If | |
Return False | |
End Function | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment