[Mono-list] Default Arguments

Chris J. Breisch cjbreisch@altavista.net
Fri, 3 May 2002 10:43:12 -0500

Thanks.  I'll try that.  Before and After are the names of the third and
fourth optional parameters.

I just copy pasted that description from the online help and didn't even
look at it.  A more valid on is:

> Public Sub Add( _
>    ByVal Item As Object, _
>    Optional ByVal Key As String, _
>    Optional ByVal Before As Object = Nothing _
>    Optional ByVal After As Object = Nothing _
> )

Sorry for the confusion.

Chris J. Breisch, MCSD, MCDBA

-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com] On
Behalf Of Brad Wilson
Sent: Friday, May 03, 2002 9:44 AM
To: Mono
Subject: Re: [Mono-list] Default Arguments

Chris J. Breisch wrote:

> I ask, because I'm trying to implement parts of
> and I'm working on the Collection class. It's Add member is defined as
> follows (VB.NET Syntax):

I don't see a class named "Collection" anywhere in MSDN.net, so it's
impossible for me to know why or where this is used, but my initial
guess is
that it's something that's only used from VB.net.

> Public Sub Add( _
>    ByVal Item As Object, _
>    Optional ByVal Key As String, _
>    Optional ByVal { Before | After } As Object = Nothing _
> )

I _think_ you should be able to do this in C#:

   void Add(
      object Item,
      [Optional] string Key,
      [Optional,DefaultValue(null)] object Value

The OptionalAttribute class is part of System.Runtime.InteropServices;
DefaultValueAttribute class is part of System.ComponentModel (which
makes me
wonder whether that's right, because it would seem to be implying that
used for COM clients, not native .NET clients).

I have no idea what that "{ Before | After }" is, and why that parameter
doesn't have a name (I surmised that it's a value for dictionary-style
collection class and named it as such). The only reference I could find
"Before" was in enumeration XmlNodeOrder.

Hope that helps,

Read my web log at http://www.quality.nu/dotnetguy/

Mono-list maillist  -  Mono-list@ximian.com