Actually, you don't. Default parameters are new as of C# 4.0. The way it was done before was by -overloading functions- based on the number of arguments. For example:
public void DoSomething(int x, int y, int z) { } public void DoSomething(int x, int y) { DoSomething(x, y, 240); // notice default value for z is 240 } On 6/21/2011 8:25 AM, black ares wrote:
Sure, but even in c# 2.0 you have default parameters.----- Original Message ----- From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>To: <programmingblind@xxxxxxxxxxxxx> Sent: Tuesday, June 21, 2011 6:06 PM Subject: Re: Java versus Python>default parameters are in dotnet from dotnet 2.0 and c# 2.0.no, they're not in .net. It's a feature of the language (as Chris already pointed out, and you apparently ignored).On 6/21/2011 8:53 AM, black ares wrote:default parameters are in dotnet from dotnet 2.0 and c# 2.0.----- Original Message ----- From: "Christopher Coale" <ccoale427@xxxxxxxxx>To: <programmingblind@xxxxxxxxxxxxx> Sent: Tuesday, June 21, 2011 5:08 PM Subject: Re: Java versus PythonNot to be picky, but let me correct you on that. Named arguments are a feature of C# 4.0, not .NET 4.0. You can use named arguments using .NET 1.1 if you wish, so long as you use Visual Studio 2010 (in order to use C# 4.0).On 6/21/2011 6:52 AM, Jamal Mazrui wrote:I think reasoned debates on these topics are appropriate for this list, as long as we avoid getting personal.I'm curious -- does Java have optional and named arguments like Python? I think these are generally a superior way of overloading functions as compared to defining multiple functions with the same name but different parameter types. It took until version 4 of the .NET Framework for these to be added as capabilities that a .NET language can use.I also think it is worth pointing out that Python generally assumes interfaces rather than data types. So, any type supporting, say, the iterable interface, can be passed to a function that relies on that capability, be it a string, list, tuple, etc. If the object passed does not support the expected interface, a runtime error occurs.Jamal __________View the list's information and change your settings at //www.freelists.org/list/programmingblind__________View the list's information and change your settings at //www.freelists.org/list/programmingblind__________View the list's information and change your settings at //www.freelists.org/list/programmingblind-- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 My programs don't have bugs; they're randomly added features! __________View the list's information and change your settings at //www.freelists.org/list/programmingblind__________View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind