Results 1 to 4 of 4

Thread: What's the best way to pass an arguement.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    88
    I developed an object and put it into the MTS. For example, ObjName.dll has a class name GetIt(Data). From client side call this object to get the data. Waht's the best way to pass the arguement "Data" by ByVal or ByRef? What's different between those two in term of network traffic? Thanks in advance.

  2. #2
    Addicted Member ShIzO's Avatar
    Join Date
    Apr 1999
    Location
    Bartlett, IL
    Posts
    189
    when it comes to COM pass it byVal always! it doesn't waste any connections between client and dll since only the value is passed not the reference.

    in VB byRef is default way of passing vars
    in VB.NET they switch default to be byVal just like in C++

    i don't really know why would they default it to byRef?!

    anybody?!
    www.HardFind.com -buy/sell/trade your used hardware.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    88
    Anyone can tell me the picture why pass ByVal doesn't hold the network traffic, but ByRef does?

  4. #4
    Addicted Member ShIzO's Avatar
    Join Date
    Apr 1999
    Location
    Bartlett, IL
    Posts
    189
    i think that byRef holds the reference to that variable
    so when you change it has to go back and put the value back to the caller. that's why the connection is active.

    byVal is used when only the value of the variable is passed not the reference to that variable thus there is no need to hold the connection over the network.

    please correct me if i'm wrong
    www.HardFind.com -buy/sell/trade your used hardware.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width