Re: Is there any way to hack around C#'s lack of support for optional arguments?
- From: Mattias Sjögren <mattias.dont.want.spam@xxxxxxxx>
- Date: Fri, 01 Apr 2005 23:17:49 +0200
>Is it totally fruitless to try to deal with optional arguments? Arguably,
>it's not even strictly an issue with arguments tagged as optional. I can
>imagine an interface that omits the OPTIONAL keyword but simply documents
>that NULL pointer values are acceptable. How can this condition (invalid
>references) be tested in C#?
The only way I can think of is to modify the interop assembly and
change the parameter types to IntPtr or int*. If you for example
change the plFlags type to int* (forcing you to use unsafe code in C#)
you can then write
if ( flags != null )
*flags = 123;
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
.
- Follow-Ups:
- References:
- Is there any way to hack around C#'s lack of support for optional arguments?
- From: Manny Vellon
- Is there any way to hack around C#'s lack of support for optional arguments?
- Prev by Date: Re: Debugging VB6.0 ActiveX in VS .NET
- Next by Date: Re: Does vb com call .net assembly in windows 2000 server?
- Previous by thread: Re: Is there any way to hack around C#'s lack of support for optional arguments?
- Next by thread: Re: Is there any way to hack around C#'s lack of support for optional arguments?
- Index(es):
Relevant Pages
|