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

发布于 2024-09-28 03:53:39 字数 469 浏览 0 评论 0原文

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;}
    }
}

VS 2010 UML 类图设计器中的模板参数集合编辑器似乎不允许您向单个泛型类型参数添加多个约束。

(图像被拒绝,因为我没有足够的“声誉”点)

我错过了什么吗?基本上,我如何在 VS 2010 UML 类设计器中建模,像代码示例中那样的多个类型参数约束?

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.

(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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风为裳 2024-10-05 03:53:39

你是对的 - VS 无法显示这一点。 UI 只允许您选择一种约束类型。

You're correct - VS can't show that. The UI only lets you pick one constraining type.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文