0

有人可以为我澄清这两者之间的语义差异:

self.foo = [NSMutableDictionary dictionaryWithCapacity:theCapacity];

self.foo = [[[NSMutableDictionary alloc] initWithCapacity:theCapacity] autorelease];

可以互换吗?如果不是,它们究竟有何不同。

提前致谢。

干杯,道格

4

1 回答 1

3

在这种情况下,它们是完全可以互换的。

dictionaryWithCapacity:theCapacity 只是一个捷径

于 2009-12-04T03:36:31.893 回答