开发者

Why is there String/string and Object/object in C#? [duplicate]

开发者 https://www.devze.com 2023-01-04 17:55 出处:网络
This question already exists: Closed 12 years ago. Possible Duplicate: String vs string in C# I know there is no differen开发者_StackOverflow中文版ce between using string and String. But
This question already exists: Closed 12 years ago.

Possible Duplicate:

String vs string in C#

I know there is no differen开发者_StackOverflow中文版ce between using string and String. But, why is there the option in C#? Is it the same for object and Object?

EDIT

Note, that I am asking why.


In the MS implementation of the C# standards, string maps to System.String and object maps to System.Object. In other implementations, this could map to other classes. So if you use string and object, you are on the safer side if you should ever compile it with another compiler.


string is just an alias for System.String. It is just a shorthand the same way that int is shorthand for System.Int32.

0

精彩评论

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