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?
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.
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 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.
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.
Sparx has just released version 9 of EA, which has support for C# 4.0.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With