字符串> [字符串]和Array℃之间的差异; [英] Difference between [String] and Array<String>

查看:111
本文介绍了字符串> [字符串]和Array℃之间的差异;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是更好的方式来声明阵列词典,我都用了:

Which is better way to declare Array and Dictionary, I have used both:

阵列<串GT;

[字符串]

对于我来说 [字符串] 是非常快的编码方面,而且在现实中如何都是在编译器和性能,我们应该遵循哪一个方面有什么不同?

For me [String] is very fast in terms of coding but in reality how both are different in terms of compiler and performance and which one we should follow?

推荐答案

从上斯威夫特iOS开发库...

From iOS Developer Library on Swift...

A型雨燕阵列是用全为数组<元素>,其中
  元件是值的数组被允许存储的类型。您可以
  也写一个数组的简写形式为[元]的类型。
  虽然的两种形式是功能相同简写形式
  为preferred
并指当使用本指南
  类型的数组中。

The type of a Swift array is written in full as Array< Element >, where Element is the type of values the array is allowed to store. You can also write the type of an array in shorthand form as [Element]. Although the two forms are functionally identical, the shorthand form is preferred and is used throughout this guide when referring to the type of an array.

<一个href=\"https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html\">https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html

这篇关于字符串&GT; [字符串]和Array℃之间的差异;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆