ho erroreImpossibile accedere a un membro non statica di tipo esterno tramite tipo annidato
Impossibile accedere a un membro non statica di tipo esterno 'Project.Neuro' via tipo annidato 'Project.Neuro.Net '
con codice come questo (semplificato):
class Neuro
{
public class Net
{
public void SomeMethod()
{
int x = OtherMethod(); // error is here
}
}
public int OtherMethod() // its outside Neuro.Net class
{
return 123;
}
}
posso spostare metodo problematico classe Neuro.Net, ma ho bisogno di questo metodo al di fuori.
In genere di principiante di programmazione oggettiva.
Grazie in anticipo.
Sembra abbastanza ovvio - 'OtherMethod' è un membro di un altro tipo. Il fatto che sia nidificato non significa che i metodi sono _inherited_. –
Vedere questa risposta SO per ulteriori informazioni: http://stackoverflow.com/a/5393472/1451531 – Splendor