You can also use the ref keyword as a return type of methods. To achieve this, add the ref keyword to the method signature and inside the method body, add ref after the return keyword. In the following code snippet, an array of string is declared and initialized. The fifth element of the string array is then returned by the method as a reference:
public ref string GetFifthDayOfWeek(){ string [] daysOfWeek= new string [7] {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; return ref daysOfWeek[4];}