What’s the difference between the ‘ref’ and ‘out’ keywords?

I’m creating a function where I need to pass an object so that it can be modified by the function. What is the difference between: public void myFunction(ref MyClass someClass) and public void myFunction(out MyClass someClass) Which should I use and why? 27 s 27 ref tells the compiler that the object is initialized before … Read more

What does ‘synchronized’ mean?

I have some questions regarding the usage and significance of the synchronized keyword. What is the significance of the synchronized keyword? When should methods be synchronized? What does it mean programmatically and logically? 17 s 17 The synchronized keyword is all about different threads reading and writing to the same variables, objects and resources. This … Read more

What is the purpose of the var keyword and when should I use it (or omit it)?

NOTE: This question was asked from the viewpoint of ECMAScript version 3 or 5. The answers might become outdated with the introduction of new features in the release of ECMAScript 6. What exactly is the function of the var keyword in JavaScript, and what is the difference between var someNumber = 2; var someFunction = … Read more