One possibility is to define two properties, one with the get accessor
and one with the set accessor.

Pradeep
http://www.tapadiya.net/pradeep

----- Original Message -----
From: "Rama Krishna" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 07, 2002 7:15 AM
Subject: [DOTNET] Different acees for set and get property accessors


> I want to have different access for set and get property accessors. Is
> there anyway to do that in C#. Ideally I want to do something like
>
> Property int MyProp
> {
>         public get
>         {
>         }
>         protected set
>         {
>         }
> }
>
> But the above code doesnot work,
>
> So I have to resort to
>
> public property int MyProp
> {
>         get
>         {
>         }
> }
>
> protected setMyProp(int  value)
> {
> }
>
> Is that the only way do do it?
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to