C# Interactive

Think...

You have a solution with multiple C# projects and include maybe 1000 classes which are so hard to debug and test. But you have a task to validate the output of certain functions when certain parameters have specific values assigned. Especially, you don't have unit tests added or difficult to implement unit tests. 

Idea...

You can use C# Interactive to cater to everything above and there are many benefits. C# Interactive is a feature that comes with Visual Studio 2015 update 1 and later versions. It is a REPL Editor for C# (Read-Evaluate-Print-Loop). If you are interested in learning how to code you can use the online version of this C# Interactive to write and execute codes. 

You can use Microsoft's C# learning site if you don't have Visual Studio installed on your PC. 

If you have Visual Studio installed in your machine you can go to View > Other Windows > C# Interactive to open the C# Interactive window.


If you want to execute any method in C# Interactive windows you can right-click on the function you want to run and select Execute in Interactive option which will add the selected method on to the Interactive windows automatically. 


You can use Console.WriteLine() method to print the output of the method that you wanted to validate.


Interestingly C# Interactive supports Intelligence so that you can easily write your code.


It supports Compile-time and Runtime errors as well which again helps to write and test the code right. 

Moreover, if you need to run any method and test any method in a DLL you can load and execute the methods as you intended. To load DLLs you can use "#r" operator with the path of the dll to be load. 

 

Additionally, you can use C# Interactive on Visual Studio Developer command prompt as well. You just open the VS Developer command prompt and type "csi" and hit enter.


Hope this will help you to speed up your coding. 
Cheers!!

Popular posts from this blog

Dependency Injection for Azure Function

How to enable Remote Desktop on Azure Cloud Service