110,825
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
void 判断控件方法(Type c_l)
if(c_l.IsAssignableFrom(cl.GetType()))
{
aa();
}
void 判断控件方法(Type c_l)
if(c_l==cl.GetType())
{
aa();
}
private bool compareType(Type targetType, object con)
{
if (con.GetType().Equals(targetType))
{
return true;
}
else
{
return false;
}
}
Button btn1 = new Button();
bool check1 = compareType(typeof(Button), btn1);