gpt4 book ai didi

c#检查确切类型

转载 作者:IT王子 更新时间:2023-10-29 04:22:48 24 4
gpt4 key购买 nike

<分区>

我想检查一个对象的类型。如果类型完全相同,我只想返回 true。继承类应返回 false。

例如:

class A {}
class B : A {}

B b = new B();

// The next line will return true,
// but I am looking for an expression that returns false here
if(b is A)

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com