Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: defi on July 24, 2012, 02:26:27 am
-
Hi!
I created an object Client with all the properties I want this Object to have. Now i want and object of type EA.Element of a Diagram to cast in an object Client. How can i do that?
I tried with EA.Element node;
Client thisNode = (Client)node;
but it doesn't work, it gives me an exception.
Can please someone help me.
Thank you a lot. And please don't tell me that I'm a noob and that I have to start over to study programming. I want some help to solve this easy (for an expert) problem. Thank you :)
-
You can't cast an EA.Element to a Client or any other type since you have no control over the creation of instances of EA.Element. You can only obtain references to EA.Element's already created for you by EA.
So, what exactly are you trying to achieve?
-
i resolved the thing, with the following code:
EA.Element node;
Client thisNode = new Client(node.ElementID);
Thank you for your help.
-
And please don't tell me that I'm a noob and that I have to start over to study programming. I want some help to solve this easy (for an expert) problem
This quote + this solution?
EA.Element node;
Client thisNode = new Client(node.ElementID);
i lol'd...
-
I think he should have use something like
Client thisNode = ***(Client)node***;
The *** indicate the fairy dust, which activates the code magic ;D
Geert