[Mono-list] An object reference is required?

Andreas Färber andreas.faerber at web.de
Fri Oct 6 17:39:06 EDT 2006


Am 06.10.2006 um 23:29 schrieb Xeno Campanoli:

> I'm sorry if this should be obvious, but i'm not finding how to make
> such an object reference. It's probably staring me right in the face.
> I've got an object variable
>
> private DoubleLinkedList StartNode;
>
> which presumably I'd use a & on in C++,
>
> and I want to assign a value to it from a variable that received the
> results of a new instantiation. The diagnostic is:
>
> BuildAndTraverseDLL.cs(58,6): error CS0120: `StartNode': An object
> reference is required for the nonstatic field, method or property
> BuildAndTraverseDLL.cs(58,6): error CS0131: Left hand of an assignment
> must be a variable, a property or an indexer
>
> from the compile, of course.

Most likely you are assigning within a static method - then you need  
a static field as opposed to an instance field.

Andreas



More information about the Mono-list mailing list