Click here to Skip to main content
15,885,365 members
Articles / Programming Languages / C#

All you need to know about .NET Remoting

Rate me:
Please Sign up or sign in to vote.
4.89/5 (94 votes)
6 Oct 2008CPOL25 min read 174.1K   3.2K   253  
.NET Remoting is available since beginning of .NET intoduction. It’s time to get to know it well eventually. I hope this topic will help you with this.
using System;

namespace ONX.Cmn
{
    public class Log
    {
        private Log()
        {
        }

        public static void Print(string text, params object[] args)
        {
            DoLog("", text, args);
        }

        public static void Info(string text, params object[] args)
        {
            DoLog("INFO ", text, args);
        }

        public static void Warning(string text, params object[] args)
        {
            DoLog("WARNING ", text, args);
        }

        public static void Error(string text, params object[] args)
        {
            DoLog("!!!ERROR!!! ", text, args);
        }

        public static void WaitForEnter()
        {
            WaitForEnter("Press ENTER to continue...");
        }

        public static void WaitForEnter(string prompt)
        {
            Console.WriteLine();
            Console.WriteLine();
            Console.Write(prompt);
            Console.ReadLine();
        }

        private static void DoLog(string prefix, string text, params object[] args)
        {
            // For newer .NET Frameworks you should use 
            // "System.Threading.Thread.CurrentThread.ManagedThreadId()"
            // as "AppDomain.GetCurrentThreadId()" is depreceted
            // there. But unfortunately it is not available in .NET v.1.1
            int threadId = AppDomain.GetCurrentThreadId();
            Console.Write("[{0:D4}] [{1}] ",
                threadId,
                DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"));
            Console.Write(prefix);
            Console.WriteLine(text, args);
        }
    } 	
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions