What is the difference between ref and out keywords?

Junior C#

Answer

ref: The variable must be initialized before passing.

out: Initialization is not required before passing, but must be assigned inside the method.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice