G
Guest
Hi,
this is probably a newbie question par excellence. Would appreciate help
nonetheless. I have just started with C# and ran into a problem.
I have created a class with several properties and methods. In one of the
methods (main actually) I create an instance of a special log file class.
This object has a lot of parameters I would like to set only once.
Now I want to use this log-file object in the other methods, too. But VS
complains that the name were not known in the current context. So apparently
the scope of this object is limited to the one method, not to the class.
Is there a way to create an object that can be used throughout a whole class?
I read something about singletons, but cannot say it really helped me a lot.
Thanks
Henrik
this is probably a newbie question par excellence. Would appreciate help
nonetheless. I have just started with C# and ran into a problem.
I have created a class with several properties and methods. In one of the
methods (main actually) I create an instance of a special log file class.
This object has a lot of parameters I would like to set only once.
Now I want to use this log-file object in the other methods, too. But VS
complains that the name were not known in the current context. So apparently
the scope of this object is limited to the one method, not to the class.
Is there a way to create an object that can be used throughout a whole class?
I read something about singletons, but cannot say it really helped me a lot.
Thanks
Henrik