C# 泛型用户控件 [英] C# generics usercontrol

查看:23
本文介绍了C# 泛型用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定义如下控件:

public partial class ObjectSelectorControl<T> : UserControl where T : class 

问题是设计者无法解决这个问题.这个问题有解决办法吗?

The problem is that the designer can't resolve this. Is there a workaround to this issue?

推荐答案

这行得通

public class Control1<T> : UserControl { ... }

public class Control2 : Control1<double> { ... }

public class Control3 : Control2 { ... }

在这里读过:

通用用户控件?

这篇关于C# 泛型用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆