Practice mode C#

Which of the following C# types is a reference type?

Correct answer C. string

Explanation

string is an alias for System.String, a class, so it is a reference type even though it behaves like a value because it is immutable. int, bool and decimal are aliases for the structs System.Int32, System.Boolean and System.Decimal, which are value types. A variable of a value type holds the data itself, whereas a reference-type variable holds a reference to an object.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.