What is the purpose of the vshost.exe file?

The vshost.exe feature was introduced with Visual Studio 2005 (to answer your comment). The purpose of it is mostly to make debugging launch quicker – basically there’s already a process with the framework running, just ready to load your application as soon as you want it to. See this MSDN article and this blog post for more information.

How do I restart my C# WinForm Application?

Unfortunately you can’t use Process.Start() to start an instance of the currently running process. According to the Process.Start() docs: “If the process is already running, no additional process resource is started…” This technique will work fine under the VS debugger (because VS does some kind of magic that causes Process.Start to think the process is … Read more

C# switch on type

See gjvdkamp’s answer; this feature now exists in C# I usually use a dictionary of types and delegates. It’s a little less flexible as you can’t fall through cases, continue etc. But I rarely do so anyway.

Styles.Render in MVC4

It’s calling the files included in that particular bundle which is declared inside the BundleConfig class in the App_Start folder. In that particular case The call to @Styles.Render(“~/Content/css”) is calling “~/Content/site.css”.

Regular expression “^[a-zA-Z]” or “[^a-zA-Z]”

Yes, the first means “match all strings that start with a letter”, the second means “match all strings that contain a non-letter”. The caret (“^”) is used in two different ways, one to signal the start of the text, one to negate a character match inside square brackets.

Specified cast is not valid.. how to resolve this

Use Convert.ToDouble(value) rather than (double)value. It takes an object and supports all of the types you asked for! 🙂 Also, your method is always returning a string in the code above; I’d recommend having the method indicate so, and give it a more obvious name (public string FormatLargeNumber(object value))

Categories c# Tags

Where to place native DLL to use Pocket PC emulator?

Suppose you have these two projects in the same Visual Studio solution: SmartDeviceProject1: the Pocket PC device application in C#. NativeDLL: the Win32 SmartDevice DLL in C++. Now you can follow the following steps: Select the Pocket PC Emulator for both project, in the Visual Studio Device Option. Deploy the projects; now in \\Program Files of your Emulator you … Read more