You can design the following types of C# delegates:
-
To create a delegate at the namespace level, create a class with the <<Delegate>> stereotype, and add an operation with the <<Delegate>> stereotype to this class and define a visibility for this operation. This visibility becomes the visibility of the delegate
![](../image/penoba1314176155484_17-rad1232634504262.image)
{
public delegate int ActionOccurred();
}
-
To create a delegate in a class, or structure, you just have to create an operation with the <<Delegate>> stereotype. In the following example, Class worker contains an internal delegate designed as an operation with the <<Delegate>> stereotype
![](../image/penoba1314176155484_17-rad1232634505809.image)
{
public class Worker
{
public delegate WorkStarted();
}
}