Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enterprise Architect: C# Optional parameters?

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

I have attempted to import existing code and get the following error:

There was an error parsing C:\MyProject\FooBar.cs on line 30. Unexpected symbol: =

Code:

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

I have also attempted to start from scratch and generate code from Enterprise Architect. I created a class, then added an operation to that class and defined the parameters. The form for editing parameters allows me to supply the "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 generated!)

namespace System {
    public class FooBar {

        /// 
        /// <param name="bar"></param>
        public void Foo(int bar){

        }

    }//end FooBar

}//end namespace System

What am I doing incorrectly?

like image 815
michael Avatar asked May 17 '11 18:05

michael


People also ask

What does an enterprise architect do?

An enterprise architect is responsible for the upkeep and maintenance of an organization's IT networks and services. As an enterprise architect, you will be responsible for overseeing, improving and upgrading enterprise services, software and hardware.

Can Enterprise Architect generate code?

Yes, in Enterprise Architect 7.5 and later releases, in the Business and Software Engineering, Systems Engineering and Ultimate editions, you can generate software and hardware code from Behavioral models.

Is Enterprise Architect hard?

Is It Hard to Become an Enterprise Architect? Yes, it is hard to become an enterprise architect. Professionals in this position must have a few years of industry experience. The best way to become an enterprise architect is to earn a bachelor's degree and gain job experience to work your way up.

Is Enterprise Architect free?

Enterprise Architect Lite is a free viewer version of Enterprise Architect, providing read-only access to models information. Available for staff, stakeholders, customers or anyone benefiting from read-only access to the model.


2 Answers

Sparx has just released version 9 of EA, which has support for C# 4.0.

like image 187
John Saunders Avatar answered Oct 04 '22 20:10

John Saunders


Optional parameters are supported from C# 4.0 and up. If you are using an older version then using them will simply not work and result in the error you are mentioning.

like image 37
Jan-Peter Vos Avatar answered Sep 30 '22 20:09

Jan-Peter Vos