This post shows you how to use C# Interactive Window in Visual Studio. C# Interactive window allows you to get immediate result on what an expression will return.

After entering a code snippet, the code simply executes right away. You can enter statements, expressions, as well as class and function definitions.

The convenience of C# Interactive is that you don't need to create a project, define a class, define a Main.

To open C# Interactive window you can select View->Other Windows->C# Interactive

C# Interactive

Now, enter your code as shown below.

Console.Write("c-sharpcode.com");

You can get your feedback immediately

c sharp code

You can enter more snippets to play C# Interactive.

public int AddNumbers(int x, int y)
{
    return x + y;
}
int a = 5;
int b = 8;
Console.Write($"a + b = {AddNumbers(a, b)}")

After entering your snippet you can see the result as shown below.

c# code

As you can see, it's very easy. C# interactive window provides you a quick way of prototyping your c# code.