I have been going through a tutorial and came across this code: \r\n
\r\n
Code:
\r\n
Private Delegate Sub DisplayTextCallback(ByVal Text As String)\r\nPrivate Sub CallDisplayTextCallback(ByVal Text As String)\r\n Dim cb As New DisplayTextCallback(AddressOf DisplayText)\r\n Dim args() As Object = {Text} \r\n Me.Invoke(cb, args)\r\nEnd Sub
\r\n
I replaced the last 2 lines of the sub with:
\r\n
Code:
\r\n
Me.Invoke(cb, Text)
\r\n
and it works perfectly. \r\n \r\nWhy did they create an object array? \r\nIs it okay to use the "Text" keyword as a variable? \r\n \r\nI would greatly appreciate any explanations.
I have been going through a tutorial and came across this code:
Code:
Private Delegate Sub DisplayTextCallback(ByVal Text As String)
Private Sub CallDisplayTextCallback(ByVal Text As String)
Dim cb As New DisplayTextCallback(AddressOf DisplayText)
Dim args() As Object = {Text}
Me.Invoke(cb, args)
End Sub
I replaced the last 2 lines of the sub with:
Code:
Me.Invoke(cb, Text)
and it works perfectly.
Why did they create an object array?
Is it okay to use the "Text" keyword as a variable?
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET. subscribe