Michel,
I would recommend you & your team review:
http://www.yoda.arachsys.com/csharp/parameters.html
Yes its C#, however the concepts on what ByRef (reference) & ByVal (value)
parameters are verses Reference types & Value types. Unfortunately far too
many developers confuse ByRef parameters with Reference Types.
I recommend only using ByRef when you actually need ByRef, that is when you
intend on changing the caller's variable itself. Anything else is simply
misleading & confusing programming.
Remember that ByVal & ByRef are how you pass parameters, Reference Types &
Value types are have values are stored...
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
|
| I am currently working in a project team where everyone is passing
| parameters byref
| i told them about the possible bugst this might raise but they said , it
is
| obvious to me what is happening and byref is faster as byval so ....
|
| well euhhh ,,, yeah .... point ......
|
| if someone has a good counter to this logic be my guest
|
|
| regards
|
| Michel Posseth [MCP]
|
| "david" <
[email protected]> schreef in bericht
| | >> Is there any reason to use:
| >>
| >> Private newPropertyValue As Integer
| >> Public ReadOnly Property MyProperty(ByRef MyParam as Integer) As
| >> Integer
| >> Get
| >> Return newPropertyValue
| >> End Get
| >> End Property
| >>
| >> instead of:
| >>
| >> Dim MyValue as Integer
| >> Public Function MyFunction(ByRef MyParam as Integer) As Integer
| >> Return MyValue
| >> End Function
| >
| > In addition to Herfried's comments, I'd add that Properties really
| > shouldn't take parameters except for simple keys and indexes. Otherwise
| > function syntax makes a lot more sense.
| >
| > BTW, why is MyParam declared ByRef in the above?
| >
| >
|
|