C# Ref returns and localsC# ref keyword allows a method to return reference rather than a value. In C# prior versions, a method can return only value. A variable that holds returned reference known as ref local. A method that returns reference has certain restrictions that are listed below.
Let's see an example. C# Ref Returns ExampleOutput: John Ref local is a variable that is used to store the reference returned by the method. Let's see an example. C# Ref Local ExampleOutput: Array: [Rahul,John,Mayank,Irfan] Updated array: [Rahul,John,Mayank,Peter] |