The Initial Code field inserts code into an operation body when the operation is first generated to file. After this point, forward code generation does not replace the existing operation code with the Initial Code field. It should also be noted that the Initial Code field is not imported into the model during reverse engineering (or synchronization).
This field is most useful when combined with UML Patterns. Elements within a pattern often require the same stub code. Notice that the language specific patterns available from www.sparxsystems.com/resources/developers/uml_patterns.html include initial code for some of the defined operations. This helps speed up the process of applying patterns from model to implementation. The Initial Code section is also useful for ensuring that the generated code is directly compilable.
This example shows the contents of the Initial Code field for the Instance() operation of the Singleton element in the C# Singleton pattern: