标题:[求助]关于 is 操作符
取消只看楼主
C_B_Lu
Rank: 1
等 级:新手上路
威 望:1
帖 子:453
专家分:0
注 册:2006-1-10
 问题点数:0 回复次数:0 
[求助]关于 is 操作符
namespace Indexers
{
struct PhoneNumber
{
public PhoneNumber(string text)
{
this.number = text;
}

public string Text
{
get { return this.number; }
}

public override int GetHashCode()
{
return this.number.GetHashCode();
}

public override bool Equals(object other)
{
return (other is PhoneNumber) && Equals((PhoneNumber)other);
}

public bool Equals(PhoneNumber other)
{
return this.number == other.number;
}

private string number;
}
}

如红色部份的代码,other是object类型, 为什么可以用other is PhoneNumber呢?
搜索更多相关主题的帖子: 操作符 
2007-06-21 00:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-149099-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.405696 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved