Passing object into Method C#

Associate
Joined
22 May 2011
Posts
1,445
Location
Edinburgh
Hey all,

I am working on some uni stuff atm that I can't get my head around, it's probably very simple but I cannot suss it.

It is a cheesey auction system running through console and within the same namespace I have my main static void with various gumf asking for name input and the highest bid you would go to etc (class is constructed outside the void in a class file).

However when I create a new method (either inside the main void or not) I can only seem to pass my object by ref into my new method, however I cannot access any of its attributes, they act as if not constructed.

Anybody got any ideas, sorry if it is not the most succinct post. It is late and I am about to go to bed :)
 
Last edited:
Can you post your code?
Sounds as if it could possibly be that the members are private and thus can't be accessed by another object, though without seeing the code it's hard to tell.
 
Could you post the code you have so far so I can see what you're doing? I may be able to help, although I'm not that experienced with OO stuff. :)
 
I'm guessing you've got a method signature such as this?:

Code:
void MethodName(object someParam)
{
  // do stuff with someParam
}
 
Back
Top Bottom