3

I want to setup function parameter setting in Visual Studio 2013 UML class diagram designer that result something like this code

public void Execute(string query = "")
    {
        ...
    }
Mehdi
  • 1,731
  • 1
  • 18
  • 33

2 Answers2

1

Operation properties

Generated method looks like

public virtual void Execute(string query = "")
{
    throw new System.NotImplementedException();
}
Dmitry Kolchev
  • 2,116
  • 14
  • 16
0

What you are talking about is called an optional argument (in C#, at least). The original documentation is pretty good on this (https://msdn.microsoft.com/en-us/library/dd264739.aspx) but the gist of it is

public void Execute(int num, string optionalstr = "")

By doing this, num is required, and optionalstr is used if it is given, otherwise defaults to the right side of the equals, in this case: an empty string.

Daric
  • 440
  • 1
  • 4
  • 12
  • bro I know how to code optional argument, I want To model string optional parameter with visual studio 2015 class diagram designer – Mehdi Apr 17 '16 at 04:19