[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Returning an instance object through a parameter..

zhaoyao

10/28/2002 8:37:00 PM

Hi All,

I'm trying to return an instance of an instance object through a parameter,
but am always getting an null...

object obj = null;
MyMethod( obj );

private bool MyMethod( obj )
{
obj = new object();
return true;
}

I used to have the ref attribute set for the parameter, but when running it
through a utility FxCop, it says consider a design where the method doesn't
require a reference parameter..

Anybody can shed me some light ?

thanks,

moses



2 Answers

Mattias Sjögren

10/28/2002 11:28:00 PM

0

Moses,

>Anybody can shed me some light ?

I suggest you ignore the FxCop warning, in this case it makes perfect
sense to use a ref (or better yet, out) parameter.



Mattias

===
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.n...
Please reply only to the newsgroup.

zhaoyao

10/29/2002 12:33:00 AM

0

Thanks, Mattias.

"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:O$0XOEtfCHA.456@tkmsftngp12...
> Moses,
>
> >Anybody can shed me some light ?
>
> I suggest you ignore the FxCop warning, in this case it makes perfect
> sense to use a ref (or better yet, out) parameter.
>
>
>
> Mattias
>
> ===
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.n...
> Please reply only to the newsgroup.