简体   繁体   English

如何在VS 2010 UML类图参数化类型中为类型参数添加多个泛型类型约束?

[英]How to add multiple generic type constraints for a type parameter in VS 2010 UML Class Diagram parameterized type?

namespace ConsoleApplication8
{
    public class Foo<T>
        where T : IFoo, IFoo2
    {
        public Foo(T fooThing)
        {
        }
    }

    public interface IFoo
    {
        string Name {get;}
    }

    public interface IFoo2
    {
        string Name2 {get;}
    }
}

The Template Parameter Collection Editor in VS 2010 UML class diagram designer, doesn't seem to allow you add multiple constraints to a single generic type parameter. VS 2010 UML类图设计器中的模板参数集合编辑器似乎不允许您向单个泛型类型参数添加多个约束。

(image was rejected because I don't have enough "reputation" points ) (图片被拒绝,因为我没有足够的“声誉”点)

Am I missing something? 我错过了什么吗? Basically, how do I model in VS 2010 UML Class Designer, multiple type parameter constraints like that in the code sample? 基本上,我如何在VS 2010 UML类设计器中建模,如代码示例中的多个类型参数约束?

You're correct - VS can't show that. 你是对的 - VS无法证明这一点。 The UI only lets you pick one constraining type. UI仅允许您选择一种约束类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM