C#

Happy tickets benchmark

Some countries have integer numbers printed on the transport tickets, for example, in ex-USSR. The ticket is "happy" when the sum of the first half of digits equals to the last half one. Then you should eat it and make a wish.

Example:

123456 and 111222 are not happy tickets
123123 and 123222 are the happy tickets

Crack C# namespaces in 30 seconds

The namespaces conception in C# seems exhaustive and insufficient at the same time in comparison with strong module notation like in Oberon-2 and even with modular programming like in Free Pascal/Delphi.

Why insufficient? You cannot declare constants and functions within namespaces but you should add a class with constant field or static method for it. It's really sad...

Why exhaustive? The "using" directive with such introduced classes is the source of unexpected errors. Here is an example below.

Subscribe to RSS - C#