开发者

Should I prefer string or String in C# or is it execlty the same? [duplicate]

开发者 https://www.devze.com 2023-02-23 00:29 出处:网络
This question already exists: Closed 11 years ago. Possible Duplicate: String vs string in C# Hello, Should I prefer string or String in C# or is it execl开发者_高级运维ty the same?stri
This question already exists: Closed 11 years ago.

Possible Duplicate:

String vs string in C#

Hello,

Should I prefer string or String in C# or is it execl开发者_高级运维ty the same?


string is an alias of String..

Both create same IL

Demonstration

string sTest;

IL Creates

IL_0000:  ret 

String sTest;

IL Creates

IL_0000:  ret 

Its already asked so many times


string is an alias System.String, they are the same. However, I would advise you to choose one and stick with it, so other people have an easier read.

0

精彩评论

暂无评论...
验证码 换一张
取 消