0
는 상기 예에서 sender
의 타입은 타입 MyClassy5
이다낮은 수준의 형식으로 성능을 향상시킬 수 있습니까?
Interface IInterface
Property MyProperty
End Interface
Class MyClassy : Implements IInterface
Public Property MyProperty
End Class
Class MyClassy2 : Inherits MyClassy
End MyClassy
Class MyClassy3 : Inherits MyClassy
End MyClassy
Class MyClassy4 : Inherits MyClassy
End MyClassy
Class MyClassy5 : Inherits MyClassy
End MyClassy
Private Sub MyHandler(sender As Object, e As EventArgs)
'Here is my question:
Dim lowLevel = DirectCast(sender, IInterface).MyProperty
'vs.
Dim highLevel = DirectCast(sender, MyClassy5).MyProperty
End Sub
이 examlpe을 고려한다.
두 가지 유형의 캐스팅간에 성능 차이가 있습니까?