Student C# Program (.Net)

Follow the link at the foot of the page to the code of MorseCode by George Wright. It is thoroughly commented and has excellent validation, emitting a beep if you type an unacceptable character such as #. We have tested it in Visual Studio and in SharpDevelop. This screenshot shows the program in action.

MorseCode in Action

MorseCode in Action

The program illustrates, for example, these features of the language.
  • (1) if statements with the Boolean comparison operators == and !=, (2) regular expressions and (3) creating a new thread in MainWindow.xaml.cs;
  • functions (ValidMessage, ValidEnglish and ValidMorse) that return a Boolean value in the Validation, class.
  • a dictionary for matching English characters with their Morse code equivalents in the Characters class;
  • the inbuilt functions Split to divide a string (at the delimiting character passed to it) into an array of substrings and ToUpper in the ConvertToMorse class.
  • (1) the property DotLength with automatic getter and setter methods, (2) foreach loops, (3) Console.Beep and (4) procedures with a variety of types of parameter in the PlayMorse class.

This 100 KB download contains all the source, and also MorseCode.exe in the bin\debug folder. (MorseCode.exe requires the installation of the .Net Common Language Runtime (CLR) to interpret its bytecode).

Programming - a skill for life!

How to apply your knowledge of Pascal when learning C#