Innovation. Imagination. Delivered. RSS 2.0
# Thursday, July 23, 2009
C# 4.0 New Features: Optional and Named Parameters
    Optional Parameters
  • removes the ceremony of method overloads to assign default values
  • static void GenerateChart(bool copyToWord = false)
    Named Parameters
  • call a method: GenerateChart(copyToWord: true);
Combining the two new features allow you to write concise code and not
specify values that are not needed in methods with a large number of arguments:
  • Old: MethodA('A', null, null, null, false, null);
  • New: MethodA(ArgA: 'A', ArgE: false);
Thursday, July 23, 2009 9:12:54 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] - Trackback
.Net v4.0 | C#
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Christopher L Price
Sign In
Statistics
Total Posts: 13
This Year: 0
This Month: 0
This Week: 0
Comments: 0
Themes
Pick a theme:
All Content © 2010, Christopher L Price
DasBlog theme 'Business' created by Christoph De Baene (delarou)