Skip to content

Instantly share code, notes, and snippets.

@c4tachan
Created December 6, 2013 21:05
Show Gist options
  • Save c4tachan/7832086 to your computer and use it in GitHub Desktop.
Save c4tachan/7832086 to your computer and use it in GitHub Desktop.
I'm trying to figure out pass by reference in C#.
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