我想要一個包含B型 的變量但是上到varaible我要檢查它是否是B.類型檢查問題
的某些子類public class A {
public System.Type acceptedType;
public B target;
public A(System.Type t1){
this.acceptedType = t1;
}
public bool connect(B b1){
if(b1 is this.acceptedType){
this.target = b1;
return true;
}
return false;
}
}
然而實例分配一個值我得到:
意外符號「這個」,希望「型」
是「System.Type的」錯誤的變量類型還是我只是誤解了「是」運營商?
'if(b1 is typeof(this.acceptedType))' – Mardoxx