The blog continues at suszter.com/WindowsMobile

Sunday, February 22, 2015

VirtualBox and Windows Phone Emulator (Hyper-V)

VirtualBox requires Hyper-V disabled but Windows Phone Emulator requires Hyper-V enabled. Since Hyper-V is either enabled or disabled I configured my system to have a boot menu for Hyper-V disabled.

I created the new boot menu with the following commands.

C:\windows\system32>bcdedit /copy {current} /d "Without Hyper-V"
The entry was successfully copied to {186a5a87-1050-11e4-8250-54ee7520341c}.

C:\windows\system32>bcdedit /set {186a5a87-1050-11e4-8250-54ee7520341c} hypervisorlaunchtype off
The operation completed successfully.

So I select between the menus during bootup depending on whether I want to use VirtualBox or do Windows Phone development.

Saturday, February 21, 2015

Displaying Binary Characters

The wrong way to display an array of random characters in the console (standard output) is like this.

    foreach (Byte by in buffer) {
        System.Console.Write(Convert.ToChar(by));
    }

It only displays ASCII characters (0-127) correctly. If you want your code to display ANY characters correctly you may use something like this.

    Console.OpenStandardOutput().Write(buffer, 0, buffer.Length);

Here is the complete example code.


You can download the source code here.

Wednesday, February 18, 2015

Getting the distinct Values of the dictionary

Recently, I needed a solution to return the distinct Values of the dictionary I worked with. In my solution I used the Distinct method with a specified IEqualityComparer. The code looks like this.


The complete source code can be downloaded from here.