This is a description of the UML sequence diagram.

Asked 2 years ago, Updated 2 years ago, 110 views

In the case of the method in the C# code below, I would like to know how to return the value with return and return it from the method.
In this case, is it okay to write a sequence diagram like an image?

public class Sample
{
    public bool IsZeroSecond()
    {
        if (DateTime.Now.Second==0)
        {
            return true;
        }

        return false;
    }
}

sequence diagram

c# uml

2022-09-30 16:02

1 Answers

In the sequence diagram, I think it is normal to write the object of the caller as well.
Return returns a value to the caller, so you don't need a black circle with a left-facing dotted line.

You may want to express the opt part, but with this sample, I don't feel uncomfortable without it.If you omit it, you can use the expression "return:bool" by subtracting only one return arrow between true and false.


2022-09-30 16:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.