Loading...

How to show Loading in Console Application in C# Tutorial... Easy Step by Step Guide

Show Loading in Console Application || C#:

Today I will show that how to show initial loading on Console Screen with the help of Threading Class in C#. It is very easy but when you do it you will love this work and your friends who didn't know this method will be amazed:

Knowing Threading:

The advantage of threading is the ability to create applications that use more than one thread of execution. For example, a process can have a user interface thread that manages interactions with the user and worker threads that perform other tasks while the user interface thread waits for user input.
This tutorial demonstrates various thread activities:
  • Creating and executing a thread
  • Synchronization of threads
  • Interaction between threads
  • Using a thread pool
  • Using a mutex object to protect a shared resource ~According to www.msdn.microsoft.com

Staring the Task(Show Loading on console Screen):

First include Threading Class in your Console Application:


Write Using System.Threading like pic given:




Now Write the Following code  in Main method:

static void Main(string[] args)
        {
            Console.Write("Loading ");
            for (int i = 0; i < 3; i++)
            {
                Thread.Sleep(1000);  // 1000 millisecond = 1 second (you can change to less or more)
                Console.Write(".");    // Writing "." to make it look like that program is loading            
            }
            Console.WriteLine();
            
        }
Output:



Commenting on a post is a great way to show some love for what you're seeing.

Google+

 
TOP