字符串vs字符串* [英] String vs String*

查看:132
本文介绍了字符串vs字符串*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个简短的问题:
我想知道

Hi all,

ihave s short question:
I want to know what the different between

String

String*

之间的区别是什么.

有人可以告诉我吗?

is.

Can someone tell me?

推荐答案

*来自C ++,不能在托管C#代码中使用.要阅读有关C ++和指针的更多信息,请搜索MSDN.不过,我警告您,如果您打算坚持使用C#(我强烈建议您这样做),请不要浪费您的时间,因为此主题可能会非常令人困惑.如果您想使用指针(功能非常强大,但很容易弄乱),请学习C ++编程.我建议您慢慢学习C ++并从教程或书中学习-如果您只是开始乱搞代码,C ++就会彻底破坏您的计算机,因为它没有C#那样的托管内存(因此C ++中没有指针, C#).

希望这会有所帮助,
Ed
The * is from C++ and cannot be used in managed C# code. To read more about C++ and pointers please search MSDN. I warn you though, if you plan to stick to C# (which I highly recommend!) don''t waste your time as this topic can be very confusing. If you wish to use pointers (which are very powerful but very easy to mess things up with), learn C++ programming. I would advise learning C++ slowly and learn from a tutorial or book - C++ is capable of utterly ruining your computer if you just start mucking around with code as it does not have managed memory in the way C# does (hence pointers in C++ but not in C#).

Hope this helps,
Ed


字符串和字符串在C#中的含义完全相同.在.NET框架中,字符串只是Common Type System(CTS)System.String类的别名(简写).代表一个字符序列.两者都被编译为IL(中间语言)中的System.String,所以没有什么区别.似乎惯例是指对象时使用string,而专门指代字符串类时使用String.
参考链接:-
在C#中,何时使用String verses string [字符串与字符串 [ C#中的字符串与字符串 [
String and string mean exactly the same thing in C#.In the .NET framework, string is simply an alias—shorthand—for the Common Type System (CTS) System.String class which represents a sequence of characters. Both of them are compiled to System.String in IL (Intermediate Language), so there is no difference.It seems that the convention is to use string when you are referring to an object and String when you are referring specifically to the string class.
Reference Link:-
In C#, When to use String verses string[^]
string versus String[^]
String vs string in C#[^]


这篇关于字符串vs字符串*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆