Click here to Skip to main content
15,889,724 members
Home / Discussions / C#
   

C#

 
GeneralMore data binding wierdness Pin
Wjousts24-Sep-03 5:36
Wjousts24-Sep-03 5:36 
Generalcanonicalize a URL Pin
24-Sep-03 5:12
suss24-Sep-03 5:12 
GeneralRe: canonicalize a URL Pin
J. Dunlap24-Sep-03 8:50
J. Dunlap24-Sep-03 8:50 
GeneralRe: canonicalize a URL Pin
Blake Coverett24-Sep-03 13:39
Blake Coverett24-Sep-03 13:39 
Questionglobal debug variable? Pin
sharkfish24-Sep-03 5:03
sharkfish24-Sep-03 5:03 
AnswerRe: global debug variable? Pin
Jim Stewart24-Sep-03 5:34
Jim Stewart24-Sep-03 5:34 
AnswerRe: global debug variable? Pin
scadaguy24-Sep-03 8:42
scadaguy24-Sep-03 8:42 
AnswerRe: global debug variable? Pin
Alvaro Mendez24-Sep-03 8:52
Alvaro Mendez24-Sep-03 8:52 
One approach is to create a class that handles the logging and keeps track of whether it's enabled or not, like this:

class Log
{
  private static bool m_enabled = System.Configuration.ConfigurationSettings.AppSettings["Logging"] == "true";
 
  public static bool Enabled
  {
     get { return m_enabled; }
  }
 
  public static void Error(string message)
  {
     if (Enabled)
        // do the logging here
  }
 
  public static void Info(string message)
  ....
}

Then you can call Log.Error, Log.Info, etc. in your code. For more details on how to use web.config, check out MSDN[^].

Regards,
Alvaro


Hey! It compiles! Ship it.
GeneralRe: global debug variable? Pin
sharkfish24-Sep-03 9:11
sharkfish24-Sep-03 9:11 
QuestionHow to create TCP Listener windows service usingC# Pin
Baqer24-Sep-03 4:52
Baqer24-Sep-03 4:52 
AnswerRe: How to create TCP Listener windows service usingC# Pin
James Simpson25-Sep-03 2:19
James Simpson25-Sep-03 2:19 
GeneralRe: How to create TCP Listener windows service usingC# Pin
Baqer25-Sep-03 5:42
Baqer25-Sep-03 5:42 
GeneralRe: How to create TCP Listener windows service usingC# Pin
James Simpson25-Sep-03 22:36
James Simpson25-Sep-03 22:36 
GeneralRe: How to create TCP Listener windows service usingC# Pin
Baqer27-Sep-03 0:50
Baqer27-Sep-03 0:50 
GeneralRe: How to create TCP Listener windows service usingC# Pin
Baqer28-Sep-03 22:36
Baqer28-Sep-03 22:36 
GeneralRe: How to create TCP Listener windows service usingC# Pin
James Simpson29-Sep-03 6:24
James Simpson29-Sep-03 6:24 
Generaldisable scrollbars of MDI Parent Form Pin
peenu24-Sep-03 1:29
peenu24-Sep-03 1:29 
GeneralRe: disable scrollbars of MDI Parent Form Pin
Gary Kirkham9-Oct-03 10:53
Gary Kirkham9-Oct-03 10:53 
QuestionHow to use AppDomain?!? Pin
ich_bins24-Sep-03 0:58
ich_bins24-Sep-03 0:58 
AnswerRe: How to use AppDomain?!? Pin
Nick Parker24-Sep-03 2:29
protectorNick Parker24-Sep-03 2:29 
GeneralRe: How to use AppDomain?!? Pin
ich_bins24-Sep-03 23:54
ich_bins24-Sep-03 23:54 
GeneralUML Designer with enteprise version of VS Pin
Andrew Torrance24-Sep-03 0:30
Andrew Torrance24-Sep-03 0:30 
GeneralVisual Studio Design time Pin
Velichko Sarev23-Sep-03 23:42
Velichko Sarev23-Sep-03 23:42 
GeneralA very odd problem Pin
morefalt23-Sep-03 23:18
morefalt23-Sep-03 23:18 
GeneralRe: A very odd problem Pin
scadaguy24-Sep-03 2:49
scadaguy24-Sep-03 2:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.