C# Property Accessibility

  • Thread starter Thread starter Mike Labosh
  • Start date Start date
M

Mike Labosh

I have a property block in this class here, and I want it to be get / set,
but the set should only be visible to the system. i.e., a user application
that uses this library should not be able to set the property. It should be
read only to the outside world, but read / write for my infrastructure.

I'm having trouble phrasing the code.

--

Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com

"Escriba coda ergo sum." -- vbSensei
 
Mike Labosh said:
I have a property block in this class here, and I want it to be get / set,
but the set should only be visible to the system. i.e., a user
application
that uses this library should not be able to set the property. It should
be
read only to the outside world, but read / write for my infrastructure.

I'm having trouble phrasing the code.

You mix accessibility like:

public int MyInt {
get {....}
internal set { ...}
}

Believe this is a .Net 2.0 feature only.

PS
 
You mix accessibility like:
public int MyInt {
get {....}
internal set { ...}
}

THAT'S COOL! I would never have thought of trying that. THANKS!

--

Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com

"Escriba coda ergo sum." -- vbSensei
 
"Mike Labosh" <mlabosh_at_hotmail_dot_com> a écrit dans le message de (e-mail address removed)...

|I have a property block in this class here, and I want it to be get / set,
| but the set should only be visible to the system. i.e., a user
application
| that uses this library should not be able to set the property. It should
be
| read only to the outside world, but read / write for my infrastructure.
|
| I'm having trouble phrasing the code.

public class Test
{
public int Value
{
get { ... }
internal set { ... }
}
}

Joanna
 
Back
Top