Pointers (references to value types?) in VB.NET
Posted on 2006-05-07
I have a class that has maybe 50 different parameters to save, load, print and initalize to default values (think of an INI file for example).
I would like to have a central ParmArrayList (say) where the name, default value, allowable range for each parameter is stored (easy so far).
I would also like this ParmArrayList to contain a pointer (or reference) to the variable that contains the actual parameter so that I may easily read/write/print all parameters by iterating through the ParmArrayList. This will be easy with string parameters (because I can easily store a reference to a string object), but for value types such as Integer or Boolean, it does not work.
Is there any way at all to somehow store the address of an integer or boolean value (to later read or write such variables through one level of indirection)
Or any ideas how I can achieve my general idea of iterating an array rather than having 50 lines of code to initialize my parameters, another 50 lines to read them, another 50 lines to write them, you get the drift...
P.S. I understand what ByRef is (and that is just fine when you want to use the ref immediately within a method; my problem is can I store the ref (to a value type)for later use