Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing array by reference to extension methods

How to pass an array to a extension method by reference.

this is what i have tried but not working.

public static void RemoveAtIndex(ref this int[] arr, int index)
like image 284
Abdul Basit Avatar asked Oct 04 '22 07:10

Abdul Basit


1 Answers

You can't send extension's target object by ref. Do you relly need it? Is array replaced by the new one by the extension method?

like image 186
Viacheslav Smityukh Avatar answered Oct 12 '22 10:10

Viacheslav Smityukh