J
Jonas Pohlandt
Hello Group,
I used something like this in a program of mine:
public class WorkObject
private _myproperty as string
public property MyProperty as string()
get,set trivial
end property
public sub new(byval mp as string)
MyProperty = mp
end sub
end class
public class Work
private _refWorkObject as new WorkObject(String.empty)
public sub new(ByRef wo as WorkObject)
wo = _refWorkObject
DoStuff()
end sub
private sub DoStuff()
'In the real program, DoStuff() gets called after some user
interaction
'and not by the constructor like in this simplified example.
'So I cant pass wo as a parameter, I have to store it as a private
variable
_refWorkObject.MyProperty = "new value"
end sub
end class
public class main
public sub main()
dim IWantThisToChange as WorkObject
dim w as new Work(IWantThisToChange)
system.console.out.writeline(IWantThisToChange.MyProperty) 'results
in "new value"
end sub
end class
Now, all of this works fine as long as I use a reference type with public
fields / properties (workobject in this case). If I try the same thing with
System.Guid instead of WorkObject, it obviously won't work. Do I really have
to wrap it, or is there some funky pointer like syntax in VB.NET that I just
haven't found yet.
I want something like
public class Work
private _refuid as new Guid()
public sub new(ByRef uid as Guid)
uid = _refuid
DoStuff()
end sub
private sub DoStuff()
_refuid = getdesiredvalue() 'With the variable that was passed into
the work constructor taking the new value of _refuid
end sub
end class
Any help is highly appreciated.
I used something like this in a program of mine:
public class WorkObject
private _myproperty as string
public property MyProperty as string()
get,set trivial
end property
public sub new(byval mp as string)
MyProperty = mp
end sub
end class
public class Work
private _refWorkObject as new WorkObject(String.empty)
public sub new(ByRef wo as WorkObject)
wo = _refWorkObject
DoStuff()
end sub
private sub DoStuff()
'In the real program, DoStuff() gets called after some user
interaction
'and not by the constructor like in this simplified example.
'So I cant pass wo as a parameter, I have to store it as a private
variable
_refWorkObject.MyProperty = "new value"
end sub
end class
public class main
public sub main()
dim IWantThisToChange as WorkObject
dim w as new Work(IWantThisToChange)
system.console.out.writeline(IWantThisToChange.MyProperty) 'results
in "new value"
end sub
end class
Now, all of this works fine as long as I use a reference type with public
fields / properties (workobject in this case). If I try the same thing with
System.Guid instead of WorkObject, it obviously won't work. Do I really have
to wrap it, or is there some funky pointer like syntax in VB.NET that I just
haven't found yet.
I want something like
public class Work
private _refuid as new Guid()
public sub new(ByRef uid as Guid)
uid = _refuid
DoStuff()
end sub
private sub DoStuff()
_refuid = getdesiredvalue() 'With the variable that was passed into
the work constructor taking the new value of _refuid
end sub
end class
Any help is highly appreciated.