C#中的字符串和字符串数据类型是什么?
字符串代表System.String,而字符串是System.String在C#中的别名-
例如-
string str = "Welcome!";
这不是必需的,但是在使用类时通常使用String-
string str = String.Format("Welcome! {0}!", user);由于string是System.String的别名。其他数据类型的别名为-
示例
object: System.Object string: System.String bool: System.Boolean float: System.Single double: System.Double decimal: System.Decimal byte: System.Byte sbyte: System.SByte short: System.Int16 ushort: System.UInt16 int: System.Int32 uint: System.UInt32 long: System.Int64 ulong: System.UInt64 char: System.Char
C#中的String类型允许您将任何字符串值分配给变量。字符串类型是System.String类的别名。它是从对象类型派生的。可以使用两种形式的字符串文字来分配字符串类型的值-带引号和@引号。
输出结果
String str = "Okay!";
热门推荐
2 训练狗狗成为
3 训练狗狗几岁
4 反应训练狗狗
5 听力训练狗狗
7 狗狗尿训练
8 拳击训练狗狗
10 狗狗训练卧室
11 一个月狗狗怎么训练
12 几个月训练狗狗大小便
13 牧羊犬训练狗狗
14 狗狗训练做
15 狗狗训练它
16 可以训练狗狗
17 训练狗狗给球
18 训练狗狗的技巧