In C# are the terms “Primitive” and “Literal” interchangeable?

前端 未结 8 742
[愿得一人]
[愿得一人] 2021-02-07 20:43

A discussion earlier today led me to question whether or not my understanding of primtives and literals is correct.


My understanding is that a literal type is spec

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-07 21:27

    Here is an MSDN page, talking about the CLS, that includes string as a primitive type:

    The .NET Framework class library includes types that correspond to the primitive data types that compilers use. Of these types, the following are CLS-compliant: Byte, Int16, Int32, Int64, Single, Double, Boolean, Char, Decimal, IntPtr, and String. For more information about these types, see the table of types in .NET Framework Class Library Overview.

提交回复
热议问题