I am using C#.NET 2008 and i was wondering about how to create a procedure to store information to trace erros in an application, I made this code:
C# |
So, I want to call this procedure from any place of my application.
I need to let this procedure and the l_Report variable visible for all code in any part of my application.
Is it possible? how?
thanks in advance,

Amit ChoudharyRank #145 · 15.8K reputationPosted Mar 22, 2010, 9:16 PM EDT
Create a class Util.cs
make your method static so that it can be accessed using directly by class name.
public static void Report(string What, string Where, string About) { static l_Report += DateTime.Now.ToString("HH:mm:ss") + "\t" + What + "\t" + Where + "\t" + About + "\r\n"; }Put it under the same namespace of your application.
and you are done.
Access the method using classname where you want.
Please mark as answer if it helps .
Eduardo14 reputationPosted Mar 24, 2010, 5:47 AM EDT
You saved my life :)
You also helped me about other things about .NET
thank you, so much!