title: Equivalent code for VB .net 2005
body: <p>I have the following code sample in VB .net 2008</p>
  
  <pre><code>Public Function CheckPathFunction(ByVal path As String) As Boolean
      Return System.IO.File.Exists(path)
  End Function
  
  Public Function PathExists(ByVal path As String, ByVal timeout As Integer) As Boolean
      Dim exists As Boolean = True
      Dim t As New Thread(DirectCast(Function() CheckPathFunction(path), ThreadStart))
  
      t.Start()
  
      Dim completed As Boolean = t.Join(timeout)
      If Not completed Then
          exists = False
          t.Abort()
      End If
  
      Return exists
  End Function
  </code></pre>
  
  <p>Unfortunately I have to work with Vb .net 2005 and net framework 2.0; How can I accomplish the same for VB .net 2005?, VB .net 2005 does not support the syntax corresponding to the code line num. 3:</p>
  
  <pre><code>Function() CheckPathFunction(path)
  </code></pre>
  
  <p>Please note that the function to call requires a parameter and returns a value</p>
  
  <hr>
  
  <p>I've tried using a delegate as indicated next but does not work</p>
  
  <pre><code>Private Delegate Function CheckPath(ByVal path As String) As Boolean
  
  Public Function CheckPathFunction(ByVal path As String) As Boolean
      Return IO.File.Exists(path)
  End Function
  
  Public Function PathExists(ByVal path As String, ByVal timeout As Integer) As Boolean
      Dim checkPathDelegate As New CheckPath(AddressOf CheckPathFunction)
  
      Dim exists As Boolean = True
      Dim t As New Thread(checkPathDelegate(path))
  
      t.Start()
  
      Dim completed As Boolean = t.Join(timeout)
      If Not completed Then
          exists = False
          t.Abort()
      End If
  
      Return exists
  End Function
  </code></pre>
  
  <p>Thanks</p>