Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: jdn4929 on September 22, 2003, 10:27:00 am
-
I can't figure out how to implement a C# Property in an interface. It asks me to specifiy an attribute, which is not required in C#. You could have:
public interface foo {
Bar {
get; set;
}
}
and it is not associated with a specific instance variable, but it is required by the implementing class. Does anybody know how to do this?
Josh
-
Well, I figured this out. Marking the stereotype Interface (method) as property will do this. The problem that I have now that the code it generates adds an access modifier to it (and all interface methods, by that token) which in C# is incorrect.
public String MyProperty { get; set; } //incorrect
String MyOtherProperty { get; set; } //correct
-
Hi Josh,
The access modifier is a bug in the C# code generation. Build 646 will resolve this and other issues with generating interfaces.
Build 646 should be released early next week. Thanks for the note.
Regards,
Ben