In an extension method, I am receiving an error that my 'out' parameter does not exist in the current context. I assume this means that extension methods cannot have 'out' parameters, but this is not specified in the documentation. I would appreciate it if someone could please clarify!
public static int customMax(this int[] data, out index)
{
int max = data[0];
index = 0;
for (int i = 1; i < data.Length; i++) {
if (data[i] > max) {
max = data[i];
}
}
return max;
}
index
parameter – Fossickindex
. – Copywriter