Book a Demo

Author Topic: Modeling C# delegates  (Read 11654 times)

DionBarrier

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Modeling C# delegates
« on: December 08, 2011, 11:11:23 am »
I'm trying to figure out a reasonable/best way to model C# delegates. EA's reverse engineering drops the ball and simply won't touch it.  Technically I know they are a syntactic sugar representation of a class but  it just seems clunky to model them that way and out-of-band with EA's Code Engineering.  Does anyone have any suggestions on how I might model the below example?  Thanks.

namespace MyNamespace
{
    public delegate void MyDelegate(MyClassA param1, MyClassB param2);
}


Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Modeling C# delegates
« Reply #1 on: December 08, 2011, 09:12:36 pm »
Hi,

Somehow delegates and event are a form of "degenerate" interface specification with exactly one method per interface and strong coupling of source/sink interface. But I'm afraid this kind of view won't help much for the code generation cycle. You might try to find a way to express delegates as specially stereotyped interfaces and have adapted code generation templates for this stereotype though.

HTH
Günther
« Last Edit: December 08, 2011, 09:14:04 pm by Makulik »