string和String

在使用c#时候,很多人会有一个小疑问:为啥一个类型会有两种写法,比如string和String, object和Object...而且两种写法等价?
主要原因是小写的是基元类型(编译器直接支持的数据类型,比如C#编译器),而大写的是FCL(Framework Class Library)中定义的类型(FCL是.NET Framework通用的)。每种基元类型都会直接映射到FCL中存在的类型,
比如string直接映射到System.String. 在编程语言中使用基元类型,主要是为了简化FCL中类型的繁琐,而编译器把基元类型生成的IL和FCL类型生成的IL,二者是一样的。

参考文档:

https://blog.csdn.net/daviemeng/article/details/76714242

https://blog.csdn.net/snakorse/article/details/43899931?utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control

string和String

上一篇:HTML5之中国象棋,附带源码!


下一篇:CAD中的绘图工具——圆弧