Geeks With Blogs

@KodefuGuru
  • KodefuGuru @FowzMasood hey, I'm a little wary of the types of requests. Send me more details: kodefuguru at live com about 1 day ago
  • KodefuGuru I hate to pick on members of the community, but it should be obvious which fusion reactor I referenced. about 2 days ago
  • KodefuGuru A giant fusion reactor, freely radiating energy, is the best source to power a civilization that has consumed its planetary fuels. about 3 days ago
  • KodefuGuru I like to peer into the dark, murky depths of the souls I consume, @bladesjester ... Okay, it actually just came that way. about 4 days ago

News


Path Notes of a Kodefu Master blog

I recently came across a piece of code that had almost every parameter for every method marked with the ref keyword. This keyword is primarily used to pass a value type by reference, but this one even had reference types marked with the keyword. This made me wonder, why exactly would you ever want to pass a reference type as a ref parameter?

Read More

Posted on Friday, June 12, 2009 4:30 PM Kodefu | Back to top


Comments on this post: ref on Reference Type?!

# re: ref on Reference Type?!
Requesting Gravatar...
Keep in mindthat even a reference type is actually passed by value. If I pass a List<> list as a parameter to a function and say list = new List<> inside that function; the calling function will not see the changed List coming back. If all I do in the called function is modify the elements of the List that was sent to me, the caller will see the changes. If I passa ref List<>, the first scenario I described will work.
Left by Michael on Jun 15, 2009 2:31 PM

Your comment:
 (will show your gravatar)
 


Copyright © Chris Eargle | Powered by: GeeksWithBlogs.net | Join free