JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Okay,
Again a moment for the uninspired lack of pointer control, but here's my issue:
I have a reference passed parameter that I basically determine if the original variable was null (nothing) I assign it a value. However, sometimes, that parameter is a Class Field and other times it is a local stack variable. How do I determine if the ByRef Param is the Class Field or if it isn't?
example:
Note, I am aware that the AddressOf() is not right. I've Tried Equals, that doesn't work because on objects it sees that Nothing = Nothing and returns true. ReferenceEquals() does the same. In Delphi (or C++) I in this instance is only retaining an Address of the original memory location for the variable, thus I could very easily compare addresses of my class field and the parameter being passed. So far I have not found a comparable method of comparing pointer addresses in VB.Net.
<edit>
Additionally, I would often like to create Optional ByRef parameters, basically, like the old VB6, if that's possible. In VB6 it used to have the ability to test parameters with IsMissing() but so far I have not found it in VB.Net.
Thanks
Again a moment for the uninspired lack of pointer control, but here's my issue:
I have a reference passed parameter that I basically determine if the original variable was null (nothing) I assign it a value. However, sometimes, that parameter is a Class Field and other times it is a local stack variable. How do I determine if the ByRef Param is the Class Field or if it isn't?
example:
VB.NET:
public class X
private _myField as Integer
public sub MyProc()
dim i as integer
if DoSomthing(i) then
'<code>
end if
end sub
public function DoSomething(byref I as integer) as boolean
if AddressOf(I) = AddressOf(_myField) then
'code
end if
I = MyComputation
end function
end class
Note, I am aware that the AddressOf() is not right. I've Tried Equals, that doesn't work because on objects it sees that Nothing = Nothing and returns true. ReferenceEquals() does the same. In Delphi (or C++) I in this instance is only retaining an Address of the original memory location for the variable, thus I could very easily compare addresses of my class field and the parameter being passed. So far I have not found a comparable method of comparing pointer addresses in VB.Net.
<edit>
Additionally, I would often like to create Optional ByRef parameters, basically, like the old VB6, if that's possible. In VB6 it used to have the ability to test parameters with IsMissing() but so far I have not found it in VB.Net.
Thanks