Practice mode C#

What does the in modifier on a C# method parameter mean?

Correct answer B. The argument is passed by reference but cannot be modified by the method

Explanation

in passes the argument by reference as read-only. It avoids copying large structs while guaranteeing the method cannot assign to the parameter. The compiler reports an error if the method tries. out is for values the method must assign, ref allows reading and writing, and optional parameters use default values instead. in is mainly a performance tool for large value types.

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.