dic 深度复制???

    NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:
                         [NSMutableString stringWithString:@"firstValue"],@"first",
                         [NSMutableString stringWithString:@"secondValue"],@"second",                          
                         [NSMutableString stringWithString:@"thirdValue"],@"third",    nil                      
                         ];
    
    NSDictionary *conDic = [dic copy];
    
    NSMutableDictionary *mulDic = [dic copy];
    
    NSLog(@"conDic:%@",conDic);
    NSLog(@"mulDic:%@",mulDic);    
    
    [[dic valueForKey:@"first"] appendString:@"append"];
    
    NSLog(@"conDic:%@",conDic);

    NSLog(@"mulDic:%@",mulDic);   


2012-03-31 15:55:12.454 DictionaryTest[4900:207] conDic:{
    first = firstValue;
    second = secondValue;
    third = thirdValue;
}
2012-03-31 15:55:12.455 DictionaryTest[4900:207] mulDic:{
    first = firstValue;
    second = secondValue;
    third = thirdValue;
}
2012-03-31 15:55:12.456 DictionaryTest[4900:207] conDic:{
    first = firstValueappend;
    second = secondValue;
    third = thirdValue;
}
2012-03-31 15:55:12.456 DictionaryTest[4900:207] mulDic:{
    first = firstValueappend;
    second = secondValue;
    third = thirdValue;
}



阅读更多
想对作者说点什么? 我来说一句

c#深度复制浅度复制

2013年10月21日 8KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭