Results 1 to 7 of 7

Thread: ByRef or ByVal? [Resolved]

Threaded View

  1. #2
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    I am not quite sure bout that but if I recall correctly,......

    if you pass an object it will always be passed by refrence.
    But yes you can also specify that using keywords ref (out) or val.

    heres an example:
    Code:
    		private void button2_Click(object sender, System.EventArgs e)
    		{
    			System.Xml.XmlDocument myDoc  = new System.Xml.XmlDocument();
    			testFunction(myDoc);
    			textBox2.Text = myDoc.SelectSingleNode("//test").InnerText;
    			
    		}
    		private void testFunction(System.Xml.XmlDocument myDoc)
    		{
    			myDoc.LoadXml("<test>value</test>");
    		}
    Please do corrcet me if I am wrong!

    Stephan
    Last edited by Sgt-Peppa; Nov 19th, 2004 at 07:49 AM.
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

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