.Net

C# + REPL + Scripting -> Life is Good

cshell_logo

Alright this time I have again made my life a bit easy by finding a solution for problem where I want to test a library but I do not want to create .Net Solution using VS and then type class and all those. Since I want to just test the working of an API so I do not want to go soo long. Someone will say then use IronRuby and do it; but then we do not get Syntax Highlighting, Code completion, intellisense and etc. (productivity enhancing tools).

So I get this nice tool called CSHELL; its a REPL for C# script (isn’t that cool).

So let me show you how I have experimented this tool by solving one of my simple issue.

Problem Description:

          As you all know we in Platform team working on DB renewal stuff and we often need to check various different Databases and their functionality. This time I wanted to check Couchbase’s functionality on How to get the list of buckets in a default pool. Terminologies may be confusing for some who does not understand about Couchbase but in simple term Bucket is a collection of JSON documents.

Steps:

1) Run cshell -> Download it from here. It is just an .exe so you can just run it. (Tips: Better to pin it up with the Taskbar for easy access);

2) You will see this main window.

CShell Main Window

3) Now I want to have the reference to Couchbase .Net SDK.

CShell Referencing DLL

4) Select the required ones

CShell Referencing DLL

5) Now I have written the statement in the script to check the problem which I described earlier. So here is the snapshot of it:

CShell Intellisense

You see I get the intellisense. isn’t that nice? And if you see a bit above that I was using a class without the reference (that too two time (tongue)) and it gives me a colourful error . That’s neat.

CShell Linq Intellisense

Intellisense with LINQ as well. Nice!!

And finally I get the result which I want.

CShell Final Result

That’s it. It took me just 5 mins to do this. Time creating this blog post is not counted 

More info you can find in http://cshell.net/.

Please share if you find something useful as well or something which does not work. Its a good way to use C# as a scripting language. 

Thanks

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 )

Google+ photo

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

Connecting to %s