gpt4 book ai didi

c# - 字符串 - ""+ 与 ""{}

转载 作者:行者123 更新时间:2023-11-30 15:28:58 25 4
gpt4 key购买 nike

<分区>

下面这两个写法有区别吗?代码为C#

String S1 = "The " + Item.Name + " is made of " + Item.Property + " and is at " + Item.Durability + "% durability."

反对

String S2 = "The {0} is made of {1} and is at {2} % durability.", Item.Name, Item.Property, Item.Durability

?假设该项目填充有例如 Axe 的名称、Steel 的属性和 50 的耐久性作为字符串。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com