 |
TraceListener creates huge log files
Lee Keable (4165 views)
TraceListener creates huge log files
If you've used the .Net trace listeners, you'll know that they just keep appending to the file specified in the App.Config file, this can lead to some massive log files Here's a simple TraceListener that logs to a new file for every day.
#c#using Syst
|
 |
Missing App.Path
Lee Keable (3103 views)
Missing App.Path
If you have the need to load resources (XSL stylesheets, images etc etc) at runtime, you may need to know the path of the currently executing code. In VB6 you'd just use good old App.Path, here is the .Net equivalent.
#c# using System.IO;
#c#
#c# string Location = Path.Ge
|
 |
Need a high resolution timer?
Lee Keable (1633 views)
Need a high resolution timer
I like to profile my code regularly to see if any changes I make during development affect performance. In .Net 1.1 there is a distinct lack of a high resolution timer object. Here's one you can use:
#c#using System;
#c#using System.Diagnostics;
#c#using Syst
|
 |
IsNumeric
Lee Keable (715 views)
IsNumeric
.NET is missing an IsNumeric function (for c# users anyway). It's dead simple to write one though:
#c#private bool IsNumeric(string s)
#c#{
#c# try
#c# {Int32.Parse(s);}
#c# catch
#c# {return false;}
#c# return true;
#c#}
|