The Sandbox Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Simple Event Timer

Back to Forum: The Sandbox
  • User profile image

    I wanted to write a simple event timer that I could use in my projects without cluttering my code. So I wrote this.


    Public Class TimeIt Implements IDisposable Private _startTime As Long Private _eventDescription As String Public Sub New(ByVal eventDescription As String) _eventDescription = eventDescription _startTime = Now.Ticks End Sub Public Sub
     Dispose() Implements IDisposable.Dispose Debug.WriteLine(String.Format("{0} took {1} milliseconds to complete.", _eventDescription, _ CDbl(Now.Ticks - _startTime) / CDbl(TimeSpan.TicksPerMillisecond))) End Sub End Class


    And I use it like this:


     Using ti As New TimeIt("Download and Decompress SDF") ZipService.Decompress(proxy.Build(salesID), path) End Using

  • User profile image

    So, will I have any disposing issues with much of the autogenerated code removed?

  • User profile image

    Ask this in techoff.


Conversation locked

This conversation has been locked by the site admins. No new comments can be made.