黄季冬=>fox23

Freesc Huang
&
Windows Embedded
数据加载中……
An Immutable Class

一个简单的Immutable Class:

class Contact
{
    
public Contact(String fullName, String phoneNumber)
    
{
        
this.fullName= fullName;
        
this.phoneNumber= phoneNumber;
    }


    
public Contact ChangeNumber(String newNumber)
    
{
        
//创建一个新实例
        return new Contact (this.fullName, newNumber);
    }


    
readonly String fullName;
    
public String FullName get return fullName; }}

    
readonly String phoneNumber;
    
public uint PhoneNumberget return phoneNumber; }}
}

posted on 2008-05-18 21:05 fox23 阅读(77) 评论(0)  编辑 收藏 所属分类: C#.NET


标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交