In this article, we will talk about the ref and out keywords in C#.
Before talking about ref and out keyword let`s first talk about how parameters are passed to a method in C#. By default when we pass parameter to a method it is passed by value (copy of the data is passed to a method). But exactly what is copied depends on whether the type is value type or reference type. Int, char, double, decimal, enum etc are built in value types in C# and class, object, delegate, string etc are built in reference types in C#.Read more