Not in C#. Not defined as valid in the language specs - get and set need
the same protection level.

Actually not possible in any CLS compliant class.

Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

-----Original Message-----
From: Rama Krishna [mailto:[EMAIL PROTECTED]] 
Sent: Dienstag, 7. Mai 2002 16:16
To: [EMAIL PROTECTED]
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.

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