IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Template Use / C# Options · View
tadler
Posted: Tuesday, August 24, 2010 11:19:36 PM
Rank: Newbie

Joined: 8/24/2010
Posts: 3
Location: Boston
Hi,

I am new to umodel, but reasonably proficient with OO/UML concepts.

Specifically, I am trying to use the IObservable interface in C#4.0
A screenshot of my desktop is here: http://www.quickphotohost.com/uploads/834eee55f9.png

I think the error message is indicating that I have not specified the type T in the interface. My problem is that for the life of me I cannot figure out how to specify it?

I tried this step outlined in another posting, but it did not have any options under the new menu.

"
*) rightclick on a class diagram
*) use New|Interface to create a new interface
*) rightclick on the new interface
*) use New|TemplateSignature to "add template capabilities"
"

Update #1: I realized that I didn't have C#4.0 installed on this machine. Tried it again on a machine with C#4.0 and didnt get anywhere.

Update #2: I imported the iobservable interface from the mscorlib binary into my project. now it doesnt let me specify that my parameters class is a sub-class of iobservable. It says 'invalid target type'


Thanks for the advice,

Tim.
cor
Posted: Friday, August 27, 2010 7:39:23 AM
Rank: Advanced Member

Joined: 9/28/2005
Posts: 371
Location: Vienna
Hello tadler!

The link to your screenshot does not work for me, so I just can assume your problems. Anway, let's try... :-)

You don't need to have C#4.0 installed on your machine that you can work with C#4.0 classes, interfaces,...
UModel installs a "predefined" include file for every major .NET version - just use "Project|Include Subproject|C#4.0|Microsoft.NET 4.0 for C#4.0".
But of course you can also import mscorlib by yourself (the "predefined" include file has been made in exactly the same way).

Since I don't see your screenshot I'm not sure how you want to "use" it.
To create a template binding, you can add a new class on your diagram and enter following text there ":IObservable<T->MyClass>".
This way you create an "anonymous template binding" - a new type which you can use for your properties, parameters,.... or to derive from.
Same you get when you specify this string directly as type of a property, parameter,...
(see screenshot below).

A detailed documentation about templates, signature, bindings,... you can find here.





cor attached the following image(s):
IObserver_Usage.png

tadler
Posted: Friday, August 27, 2010 11:33:47 AM
Rank: Newbie

Joined: 8/24/2010
Posts: 3
Location: Boston
Thanks - that worked.

I didn't realize that just typing in the label was all that was required. The documentation makes a lot more sense now.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.