TOOLS-Mini C# Lab Ver 1.0
Did this ever occur to you?
You wanted to write several lines of C# code to clarify some syntax or parameter format, or you needed a one-time program to process log files. You started Visual Studio 2005/2008, created a new console application project, wrote several lines of code, then build, run, and finally got the result. What if the answer you wanted to know is simply whether decimal.ToString("N2") will return the correct formatted number? How long have you been waited before writing the first line of code? After you got the answer, would you spend several seconds to delete the *.csproj, *.cs files?
Quite often I felt that I spent 60% of my time on waiting for Visual Studio initialization and project operation, 40% on coding and execution, and it ended up left a whole bunch of unnessary files in my workspace. This is not efficient at all! In these cases, Visual Studio is too heavy, but coding with notepad and csc.exe is too lousy. What I really need is a light-weight IDE than can startup in one second and allows me to edit the code directly and run it with one click. So, here is my Mini C# Coding Lab.
Mini C# Lab is a .NET 2.0 winform application with single 13KB exe file. As you see, the UI is quite simple and easy to use. Write the code on the code editor, then click "Run" button to check the result. The colorful formatting effect is based on Manoli's CSharpFormat. I use an easy, stupid but inefficient way to implement the formatting, so it's not real time. The RichTextEditor refreshes every time when you press after up/down/enter key, so don't try to edit a very long code. (It's only for "mini", right?)
The code is running in another thread, so you can stop it if it hang or the time is longer than you expected. Mini C# Lab also provide simple open and save function, so you can keep your source code in single .cs file for furture use.
OK, that's all, try it and feel free to send me feedback
Download Ver 1.0
【中文摘要】
你是否有這樣的經驗?
只想寫兩行Code,試試某個語法的效果,或做個一次性轉檔。為了這幾行Code,你得開啟Visual Studio,等待它啟動,建一個專案,寫兩行Code,建置、執行、搞定,然後留下一整個專案資料夾跟一堆不會再用第二次的檔案。算一算,寫Code只花了40%的時間,卻花了60%的時間等待Visual Studio的啟動及建立專案上,更甭提這個"免洗"專案所留下的一堆殘檔。
我以前會偷用Word或Excel的巨集功能用來測試VB語法,試完後選擇不存檔,整個處理速度比啟動VB6來得快,且什麼都不留下。Office到了2007,也還不能在VBA裡寫.NET,我一直為在.NET方面找不到類以的替代方案而惋惜。
那麼... 自己寫一個吧!
Mini C# Lab是一個.NET 2.0 WinForm程式,只有一個13KB的獨立執行檔,免安裝,直接執行即可。你可以用上面的編輯視窗直輸入寫C#程式,利用Console輸出結果。編輯欄位我用了Manoli's CSharpFormat標出顏色,不過用的是簡單但笨拙的做法,一整行寫完後才會更新,而且,由於它每次整段程式都要重新顯示,不適合太長的程式碼。(記住,我本來只是想"Mini"而已呀!)
程式碼在另一個Thread執行,所以執行過程可以Cancel;另外,你也可以將程式碼儲存成.cs供下回再讀取應用,比Visual Studio的Project模型簡便許多。
有需要的朋友可以試試看,想到什麼建議再反應給我吧!