I\'d like to assign a reference to a member field. But I obviously do not understand this part of C# very well, because I failed :-) So, here\'s my code:
public
At this line:
this.parameter = parameter;
...you copy the method parameter to the class member parameter
. Then, in Init()
you are assigning the value "success", again, to the class member parameter
. In your Console.Writeline, then, you are writing the value of the method parameter, "failed", because you never actually modify the method parameter.
What you are trying to do - the way you are trying to do it - is not possible, I believe in C#. I wouldn't try passing a string
with the ref
modifier.