Search code examples
visiogeneric-listuser-defined-types

How to specify a List<MyCustomType> as a "Return Type" for a UML Interface Property


In my Visio 2007 UML document I am unable to figure out how I can add an operation to an Interface that returns a generic List<MyCustomType> type.

For example:

Say I have a class named "MyClass" and an Interface named "IFace". IFace has a signature of a method that returns a Generic List of MyClass.

For clarity, here's an example of the C# code:

namespace StackO
{
    public interface IFace
    {
        List<MyClass> SomeMethod(string data);    
    }

    public class MyClass
    {
    }
}

Here's a screenshot of where I'm stuck: enter image description here

It seems as though the only way to specify a List<MyClass> as my Return Type is to create another user-defined datatype that is explicitly written as List<MyClass>. If this is the case, so be it. However, I'm posting this in hopes that there is a better/proper way to do this.

How can I define the Return Type of an Operation of a Visio Interface to be a Generic List of a User-Defined Datatype?


Solution

  • In the Class diagram properties > Go to operations > select the return type you are interested in changing and click properties.

    In the next dialog you will have option for setting prefix List< and suffix >.

    This way you can specify the return type as List<>.

    I see this option in Visio 2010. But I am not sure if this option is available in Visio 2007.