Difference between Ref and Out in c# .Net?

1) Both keywords are used for passing a parameter by reference both are treated as same at compile time but behave differently at runtime.
2) If you pass a parameter by ref then you need to initialize that variable outside the method.
3) If you pass a parameter by out then there is no need to initialize that variable outside the method. But you need to initialize that variable before control pass from that method.

Comments

Popular posts from this blog

What is CLR and Its functionality?

What is Namespace in .net?