Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string is not primitive #5

Open
nakov opened this issue Dec 11, 2021 · 0 comments
Open

string is not primitive #5

nakov opened this issue Dec 11, 2021 · 0 comments

Comments

@nakov
Copy link
Owner

nakov commented Dec 11, 2021

String is not primitive. It is built-in type, but not primitive. It is reference type, unlike int.

Reported by Nick Murphy (lecturer at Kennesaw State University).

In our lecture section, one of our quiz questions is "Strings (or strings) are a primitive datatype", which we say is false. A student contacted me and showed me page 112 of your textbook, which states that Strings are a primitive datatype in C#.

If you check the "isPrimitive" property of a string in C#, as in the following command:
Console.WriteLine("{0} is a primitive data type: {1}.", typeof(string).Name, typeof(string).IsPrimitive);
it will indicate that C# considers strings to not be primitive.

I believe the issue could be clarified by separating "built-in type" from "primitive" in the description. Strings are built-in to C# (unlike C++), but they are still complex/non-primitive data types compared to ints or chars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant