Potentially easy question here, I'm getting the error: Cannot apply indexing with [] to an expression of type 'System.Array'
public Array hello()
{
var damn = new[] { a2,a3,a4,a5,a6,a7,a8,a9};
return damn;
}
private void a1disable()
{
var a = new[] { a1, a2, a3, a4, a5, a6, a7, a8, a9 };
var b = hello();
a[1].Enabled = false;
b[1].Enabled = false;
}
a[1].Enabled = false; works absolutely fine! it's just b[1].Enabled = false; which throws the error i described above, i haven't used arrays much before so i'm sorry if the answer seems obvious, i'm just looking for clarification as to why this is happening.
Thanks in advance if you can help :)
hello()method compiles as you are casting SomeClass[] to Array. Upvote for a question that has shown me something I didn't know.