This question already has an answer here: What is the difference between String and string in C#? 59 answers It is the same. string is an alias of class System.String . some common aliases: object ==> System.Object string ==> System.String bool ==> System.Boolean int ==> System.Int32 float ==> System.Single double ==> System.Double decimal ==> Syst
这个问题在这里已经有了答案: String和C#中的字符串有什么区别? 59个答案 这是相同的。 string是类System.String的别名 。 一些常见的别名: object ==> System.Object string ==> System.String bool ==> System.Boolean int ==> System.Int32 float ==> System.Single double ==> System.Double decimal ==> System.Decimal char ==> System.Char String.Empty和
Possible Duplicate: In C# what is the difference between String and string In C# there is string and there is System.String . What is the difference between these? Is one considered better to use that the other. Are there any hidden dangers in mixing the use of them? If they are the same, then why have them both? Why not just have one or the other? System.String is the name of the ac
可能重复: 在C#中字符串和字符串有什么区别 在C#中有string并有System.String 。 这些有何区别? 有人认为使用另一个更好。 混合使用它们有没有隐藏的危险? 如果它们是相同的,那么为什么它们都是? 为什么不只是有一个或另一个? System.String是实际.NET CLR类的名称,就像System.Int32是该类的真实名称一样。 但C#的设计者希望它看起来很像C和C ++,其中本地类型(如int )是小写字母,因此它们为基本本机
Possible Duplicate: In C# what is the difference between String and string what's the difference between the String and string. In C#, which is preferred? Actually string is an alias for System.String but erash is basically right... Here is a list of other alias' shamelessly lifted from Jon Skeet in this post: * object: System.Object * string: System.String * bool: System.Boolea
可能重复: 在C#中字符串和字符串有什么区别 字符串和字符串有什么区别。 在C#中,这是首选? 其实string是System.String的别名,但是erash基本上是正确的... 下面是在这篇文章中从Jon Skeet无耻地解除的别名列表: * object: System.Object * string: System.String * bool: System.Boolean * byte: System.Byte * sbyte: System.SByte * short: System.Int16 * ushort: System.UInt16 * int: System.Int32 * uint:
Possible Duplicate: What is the difference between String and string When I run: char c1 = 'a'; Console.WriteLine(c1); and when I run: Char c2 = 'a'; Console.WriteLine(c2); I get exactly the same result, a . I wanted to know what is the difference between the two forms, and why are there two forms? The result is exactly the same. Both represent the same type, so the resulting executa
可能重复: 字符串和字符串有什么区别 当我运行时: char c1 = 'a'; Console.WriteLine(c1); 当我跑步时: Char c2 = 'a'; Console.WriteLine(c2); 我得到完全相同的结果, a 。 我想知道这两种形式有什么区别,为什么会有两种形式? 结果完全一样。 两者都代表相同的类型,因此生成的可执行文件完全相同。 char关键字是框架中System.Char类型的C#语言的别名。 您始终可以使用char关键字。 要使用Char你需要
This question already has an answer here: What is the difference between String and string in C#? 59 answers 它们是相同的东西 - string只是System.String的别名和System.Boolean bool They are exactly the same. But I think it's worth noting (in case you have a multi-language persuasion), that in Java, the boolean and Boolean types are not the same. bool is an alias for System.Boolean just
这个问题在这里已经有了答案: String和C#中的字符串有什么区别? 59个答案 它们是相同的东西 - string只是System.String的别名和System.Boolean bool 他们完全一样。 但是我认为值得注意的是(如果你有多种语言的说服力),在Java中,布尔类型和布尔类型是不一样的。 bool是System.Boolean的别名,就像int是System.Int32的别名一样。 在这里查看完整的别名列表。 和例子 int x = 123; System.Int32 x = 123;
Possible Duplicate: In C# what is the difference between String and string Should I use string or String when declaring a basic string variable in c# and does it matter? 这并不重要,但最好保持一致:小写string是String的别名。 我喜欢string因为VS以深蓝色突出显示(这使得它变成了awesomer)。 The string keyword is an alias for System.String . (The same goes for int - System.Int32 long - System.
可能重复: 在C#中字符串和字符串有什么区别 在c#中声明一个基本的字符串变量时,我应该使用string还是String ?它是否重要? 这并不重要,但最好保持一致:小写string是String的别名。 我喜欢string因为VS以深蓝色突出显示(这使得它变成了awesomer)。 string关键字是System.String的别名。 (对于int - System.Int32 long - System.Int64也是如此) 对于基元,C#没有两种不同的表示形式,就像Java一样。 ( int
In C# there are String objects and string objects. What is the difference between the two? What are the best practices regarding which to use? There is no difference. string (lower case) is just an alias for System.String. No difference. System.String is strictly identical to string . Common C# coding guidelines indicates that you should use the keyword string . They are aliases and a
在C#中有String对象和string对象。 两者有什么区别? 什么是使用哪种最佳实践? 没有区别。 字符串(小写)只是System.String的别名。 没有不同。 System.String与string严格相同。 通用C#编码指南指出您应该使用关键字string 。 它们是别名,可以互换。 但是,在风格上,对于声明,我使用小写字符串,对于静态方法,我使用String。 string foo = "bar"; if( foo != String.Empty ) { Console.WriteLine(Stri
This question already has an answer here: What is the difference between String and string in C#? 59 answers The byte keyword is an alias for the System.Byte data type. They represent the same data type, so the resulting code is identical. There are only some differences in usage: You can use byte even if the System namespace is not included. To use Byte you have to have a using System
这个问题在这里已经有了答案: String和C#中的字符串有什么区别? 59个答案 byte关键字是System.Byte数据类型的别名。 它们表示相同的数据类型,因此生成的代码是相同的。 使用方式只有一些差异: 即使没有包含System名称空间,也可以使用byte 。 要使用Byte你必须有一个using System; 在页面的顶部,或者指定完整的命名空间System.Byte 。 有几种情况,C#只允许您使用关键字,而不是框架类型,例如: 。 enum
I have a small piece of code about the sizeof operator with the ternary operator: #include <stdio.h> #include <stdbool.h> int main() { bool a = true; printf("%zun", sizeof(bool)); // Ok printf("%zun", sizeof(a)); // Ok printf("%zun", sizeof(a ? true : false)); // Why 4? return 0; } Output (GCC): 1 1 4 // Why 4? But here, printf("%zun", sizeof(a ? true :
我有一个关于sizeof运算符和三元运算符的小代码: #include <stdio.h> #include <stdbool.h> int main() { bool a = true; printf("%zun", sizeof(bool)); // Ok printf("%zun", sizeof(a)); // Ok printf("%zun", sizeof(a ? true : false)); // Why 4? return 0; } 输出(GCC): 1 1 4 // Why 4? 但在这儿, printf("%zun", sizeof(a ? true : false)); // Why 4? 三元运算符返
Why does this code compile? _Static uint32_t my_arr[2]; _Static_assert(sizeof(my_arr) == 8, ""); _Static_assert(sizeof(my_arr[0]) == 4, ""); _Static_assert(sizeof(my_arr)[0] == 4, ""); The first 2 asserts are obviously correct, but I would have expected the last line to fail, as my understanding is that sizeof() should evaluate to an integer literal, which can't be treated as an array. In
为什么这个代码编译? _Static uint32_t my_arr[2]; _Static_assert(sizeof(my_arr) == 8, ""); _Static_assert(sizeof(my_arr[0]) == 4, ""); _Static_assert(sizeof(my_arr)[0] == 4, ""); 前两个断言显然是正确的,但我会期望最后一行失败,因为我的理解是sizeof()应该计算为一个整数字面值,它不能被视为一个数组。 换句话说,它会以与下面一行失败相同的方式失败: _Static_assert(4[0] == 4, ""); 有趣的是,以下内容