Hardcode

Making it happen

RSS FeedsFollow me on Twitter!

  • Home
  • About
« ASP
Visual Studio 2008 "View Code" hotfix »

C# return reference types

Share this post!
  • Twitter
  • Digg
  • Facebook
  • Delicious
  • StumbleUpon
  • Google Bookmarks
  • LinkedIn
  • Yahoo Bookmarks
  • Technorati Favorites
Print article This entry was posted by andrei on March 18, 2008 at 2:40 pm, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site.
  • Comments (2)
  • #1 written by http://
    about 2 years ago

    I agree. Having the option to return refs to structs would be nice, especially with collection indexers. I guess they haven’t allowed this because of issues of structs being stored on the stack.

  • #2 written by http://
    about 2 years ago

    Another situation where this is annoying is here:

    vectors.ForEach(delegate(Vector2 c) { c.X = 4; c.Y = 2; });

    Each element is copied as it’s passed as a parameter into the delegate, and it’s incorrect to write delegate(ref Vector2 c). The result is that vectors is not modified and you just spent a whole lot of time making garbage.

No trackbacks yet.
  • Oracolul
    • Popular posts
    • Archives
    • Tags
    • Categories
    • Uncategorized (542)
    • February 2011 (1)
    • January 2011 (1)
    • November 2010 (3)
    • August 2010 (1)
    • July 2010 (3)
    • June 2010 (2)
    • May 2010 (3)
    • March 2010 (3)
    • February 2010 (1)
    • November 2009 (1)
    • September 2009 (2)
    • August 2009 (1)
    • July 2009 (3)
    • June 2009 (1)
    • April 2009 (2)
    • March 2009 (10)
    • February 2009 (4)
    • January 2009 (7)
    • December 2008 (9)
    • November 2008 (9)
    • October 2008 (9)
    • September 2008 (7)
    • August 2008 (12)
    • July 2008 (8)
    • June 2008 (17)
    • May 2008 (8)
    • April 2008 (3)
    • March 2008 (16)
    • February 2008 (10)
    • January 2008 (8)
    • December 2007 (11)
    • November 2007 (12)
    • October 2007 (17)
    • September 2007 (1)
    • August 2007 (12)
    • July 2007 (5)
    • June 2007 (1)
    • May 2007 (15)
    • April 2007 (14)
    • March 2007 (12)
    • February 2007 (6)
    • January 2007 (13)
    • December 2006 (10)
    • November 2006 (12)
    • October 2006 (14)
    • September 2006 (8)
    • August 2006 (8)
    • July 2006 (7)
    • June 2006 (6)
    • May 2006 (8)
    • April 2006 (12)
    • March 2006 (19)
    • February 2006 (22)
    • January 2006 (15)
    • December 2005 (8)
    • November 2005 (23)
    • October 2005 (14)
    • September 2005 (15)
    • August 2005 (12)
    • July 2005 (18)
    • June 2005 (9)
    • May 2005 (15)
    • April 2005 (3)
    • Who wants a Joost invitation? (193)
    • Challenge 2 (8)
    • Remove rows from DataTable (6)
    • Experts Exchange – subscribe for solution ? or not (5)
    • Did you know that … (4)
    • Midlet self-replication (4)
    • wglChoosePixelFormatARB fails on nVidia (3)
    • try to catch … access violation (3)
    • Why Symbian sucks (3)
    • Japan’s software industry (3)
  • Blogroll

    • Adrian Drumea
    • Artech Software
    • Bookaholic
    • Catalin Francu
    • Coding Horror
    • Cristi Streng
    • Cultura-vura
    • flv's zuzoom
    • HackersBlog
    • infoarena
    • John Carmack
    • John Romero
    • Mihai Pătraşcu
    • O bere in fiecare bar din Bucuresti
    • Stand-up Programming in Romania
    • The Daily WTF
    • Una pe zi cu Novac
  • Stuff I’ve bought

  • Daca vrei sa-mi iei ceva

Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top