Power of Immediate Window in Visual Studio


While debugging the application, so many developer will get the scenario to read return input and do the evaluation on basic of that input data. In this scenario immediate window will be very handy tool for developer.

It is available since from initial version of visual studio i.e. Visual Studio 2000. At that time there was no code intelligence.

It has so many cool features which will make the developer life essay to debug the code

1. We can evaluate the return values of method particularly if it is being called by client code

2. We can interact with variable and execute the expression in memory

3. we can easily view the data source while debugging

4. we can easily view the variable holding data.

5. We can easily read the json or soap input data in immediate window. It will be easy to do copy
paste functionality.

Sample code for demo

using System;
using System.Data;

namespace ConsoleApp2
{
    public class Program
    {
        static void Main(string[] args)
        {
            int a = 100;
            Test obj = new Test();
            Console.WriteLine(a);

            //Storing data in straing array
            string[] name = new[] { "Ram", "Mohan", "Chandradev" };

            //Storing data in datatable
            DataTable dt = new DataTable();
            dt.Columns.Add("UserId", typeof(int));
            dt.Columns.Add("UserName", typeof(string));
            dt.Columns.Add("Password", typeof(string));
            dt.Rows.Add(1, "Ramesh", "Chandradev");

            Console.Read();
           
        }

        private static int GetSum(int a, int b)
        {
            return a + b;
        }
    }

    public class Test
    {
        public string GetMessage()
        {
            return "hello";
        }
    }
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.