Created
December 6, 2013 21:05
-
-
Save c4tachan/7832086 to your computer and use it in GitHub Desktop.
I'm trying to figure out pass by reference in C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class foo | |
{ | |
int a; | |
int b; | |
int c; | |
GenericLargeExistingClass glec = new GenericLargeExistingClass(); | |
foo() | |
{ | |
} | |
} | |
public static void Main() | |
{ | |
foo exampleFoo = new foo(); | |
//Which of these is faster? | |
passByVal(exampleFoo); | |
passByRef(ref exampleFoo); | |
} | |
public void passByVal(foo f) | |
{ | |
// Some stuff occurs using f | |
} | |
public void passByRef(ref foo f) | |
{ | |
// Some stuff occurs using f | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment