Enterprise Architect: C # Advanced Options?

Any option for Enterprise Architect to recognize optional parameters in C #?

I tried to import the existing code and get the following error:

An error occurred while parsing C: \ MyProject \ FooBar.cs on line 30. Unexpected character: =

The code:

public void Foo(int bar = 1) //Line 30 { } 

I also tried starting from scratch and generating code from Enterprise Architect. I created a class, then added an operation to this class and defined the parameters. The form for editing parameters allows me to specify "Name", "Type" and "Default" (as well as other information). I added Name: bar, Type: int, Default: 1. Then, when I generated the code, this is what I get (no optional parameter is generated!)

 namespace System { public class FooBar { /// /// <param name="bar"></param> public void Foo(int bar){ } }//end FooBar }//end namespace System 

What am I doing wrong?

+6
source share
2 answers

Sparx has just released EA version 9 , which supports C # 4.0.

+5
source

Advanced options are supported with C # 4.0 and above. If you are using an older version, then their use simply does not work and will lead to the error that you mention.

+2
source

Source: https://habr.com/ru/post/888351/


All Articles