Evgeny Pokhilko's Weblog

Programmer's den

How to load referenced assemblies from any place you want

This is HowTo for those who need it. The app.config file below defines rules for the main assembly. It sets where the referenced assemblies could be found at runtime. The main assembly references other two assemblies and gets one of them from network (\\someserver\shared\Summator.dll) and another one from the local machine in a subdirectory.

Application config file is below:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            culture="neutral" />
      <probing privatePath="SUB1\SUB2\SUB3\">

If you reference an assembly from your local machine, you are not limited by subdirectories of the main application because you can use the following method to mount your drives to one of the subdirectories:


PS: Configuration files can be conveniently edited by the mscorcfg.msc tool (Control Panel – Administrative Tools – Microsoft .NET Framework 2.0 Configuration, MyComputer, Application, Right click, Add…).

June 25, 2008 Posted by | .NET | | Leave a comment

Monty Hall Problem

monty hall

A colleague of mine gave me the following puzzle to solve, which is the famous Monty Hall problem:

Suppose you’re on a game show, and you’re given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say number 1, and the host, who knows what’s behind the doors, opens another door, say number 3, which has a goat. He says to you, “Do you want to pick door number 2?” Is it to your advantage to switch your choice of doors?

In the evening I wrote a simple console application that proves the solution practically running the game 10000 times.

The application shows you validation of the .NET random engine first. There are percentages of 0, 1, 2 numbers received from the Random class executed for 10000 times. Then it shows percentage of success when you “pick door number 2” (switching your choice) and percentage of success when you stay with your first selected door.

The success rate is 2/3 when the door is switched and 1/3 for the runs that stick. There is only one cs file on GitHub. You can compile it in Visual Studio command line “csc.exe GoatSelector.cs” and execute GoatSelector.exe.

June 25, 2008 Posted by | .NET | , , | 2 Comments