For this example we will be looking at the code below.
It is almost unnoticeable, but there is a property in this code here:
Anytime there is a reference that looks like a method call without any () it is a property. This particular property gets the private name field from the Food class.
This property is represented in a sequence diagram like this:
The call to a getter property is just like a method call except without the (). It has a return type just like a method would.
Also note that the get in this diagram is surrounded in [ ] rather than < > like in a class diagram. This is NOT convention for sequence diagrams but is used for testing purposes. In instructions you will see it represented as < >.
For this example we will be looking at the code below.
The code has a few getters (IsGood and Name) and then a setter (Rating). The Rating property looks like this:
And is represented in a sequence diagram as:
To indicate the set of a property we need to add the property name, a colon, the type it is and the [set] notation. Note that this is not the convention we will be using when showing setters in instructions.