鉴于字符串在.NET中是不可变的,我想知道为什么它们被设计为string.Substring()需要O(substring.Length)时间,而不是O(1)?
string.Substring()
substring.Length
O(1)
即,有什么权衡,如果有的话?
.net c# string substring time-complexity
.net ×1
c# ×1
string ×1
substring ×1
time-complexity ×1