Click here to Skip to main content
15,887,302 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: Byref or Byval : which is faster and consume less memory Pin
ZurdoDev22-Jan-15 10:34
professionalZurdoDev22-Jan-15 10:34 
AnswerRe: Byref or Byval : which is faster and consume less memory Pin
PIEBALDconsult22-Jan-15 10:38
mvePIEBALDconsult22-Jan-15 10:38 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
dilkonika22-Jan-15 10:49
dilkonika22-Jan-15 10:49 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
PIEBALDconsult22-Jan-15 10:52
mvePIEBALDconsult22-Jan-15 10:52 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
dilkonika22-Jan-15 10:59
dilkonika22-Jan-15 10:59 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
PIEBALDconsult22-Jan-15 11:08
mvePIEBALDconsult22-Jan-15 11:08 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
dilkonika22-Jan-15 11:15
dilkonika22-Jan-15 11:15 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
Dave Kreskowiak22-Jan-15 17:06
mveDave Kreskowiak22-Jan-15 17:06 
In your example, both are passing a pointer to the BindingSource. In the case of a ByRef, your passing the pointer to the object. By passing a reference type ByVal, you're passing a copy of the pointer. Both will allow you to call methods and make changes to properties in the original object. But, ByRef will allow you to replace the original object with a new one. Passing a reference type ByVal will not.

For value types, if you pass them ByVal you are passing a copy of the value. Changing the variable in the called method does nothing to the original passed in value.

If you pass in a value type ByRef, you're passing in a pointer to the value. Any change to the variable containing the value will change the original value in the calling code.

Where you run into a performance hit, albeit as very small one, is when you pass a large structure by value. Each value type in the structure, when passed ByVal, is copied and passed to the target method. For those types, it's probably better to pass a structure ByRef.

Read this[^].
A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: Byref or Byval : which is faster and consume less memory Pin
ZurdoDev22-Jan-15 11:18
professionalZurdoDev22-Jan-15 11:18 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
PIEBALDconsult22-Jan-15 11:21
mvePIEBALDconsult22-Jan-15 11:21 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
dilkonika22-Jan-15 11:23
dilkonika22-Jan-15 11:23 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
PIEBALDconsult22-Jan-15 11:41
mvePIEBALDconsult22-Jan-15 11:41 
AnswerRe: Byref or Byval : which is faster and consume less memory Pin
ZurdoDev22-Jan-15 13:36
professionalZurdoDev22-Jan-15 13:36 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
dbitsch22-Jan-15 15:34
dbitsch22-Jan-15 15:34 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
ZurdoDev22-Jan-15 16:00
professionalZurdoDev22-Jan-15 16:00 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
Dave Kreskowiak22-Jan-15 17:09
mveDave Kreskowiak22-Jan-15 17:09 
GeneralRe: Byref or Byval : which is faster and consume less memory Pin
Dave Kreskowiak22-Jan-15 17:07
mveDave Kreskowiak22-Jan-15 17:07 
QuestionHow to create relationship of 2 tables using OleDbConnection Pin
gwittlock17-Jan-15 11:36
gwittlock17-Jan-15 11:36 
AnswerRe: How to create relationship of 2 tables using OleDbConnection Pin
PIEBALDconsult17-Jan-15 12:02
mvePIEBALDconsult17-Jan-15 12:02 
GeneralRe: How to create relationship of 2 tables using OleDbConnection Pin
gwittlock17-Jan-15 12:12
gwittlock17-Jan-15 12:12 
AnswerRe: How to create relationship of 2 tables using OleDbConnection Pin
gwittlock17-Jan-15 22:45
gwittlock17-Jan-15 22:45 
GeneralRe: How to create relationship of 2 tables using OleDbConnection Pin
AccessDeveloper29-Jan-15 7:01
AccessDeveloper29-Jan-15 7:01 
QuestionClick on "connect" button, the progressbar is filled, a label appears writing if it is connected to the support or not Pin
Member 1138076216-Jan-15 10:12
Member 1138076216-Jan-15 10:12 
AnswerRe: Click on "connect" button, the progressbar is filled, a label appears writing if it is connected to the support or not Pin
Eddy Vluggen16-Jan-15 13:15
professionalEddy Vluggen16-Jan-15 13:15 
AnswerRe: Click on "connect" button, the progressbar is filled, a label appears writing if it is connected to the support or not Pin
Richard MacCutchan16-Jan-15 22:49
mveRichard MacCutchan16-Jan-15 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.