PC Review


Reply
Thread Tools Rate Thread

C# Property Accessibility

 
 
Mike Labosh
Guest
Posts: n/a
 
      16th Feb 2007
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


 
Reply With Quote
 
 
 
 
PS
Guest
Posts: n/a
 
      16th Feb 2007

"Mike Labosh" <mlabosh_at_hotmail_dot_com> wrote in message
news:(E-Mail 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.


You mix accessibility like:

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

Believe this is a .Net 2.0 feature only.

PS

> Peace & happy computing,
>
> Mike Labosh, MCSD MCT
> Owner, vbSensei.Com
>
> "Escriba coda ergo sum." -- vbSensei
>
>



 
Reply With Quote
 
Mike Labosh
Guest
Posts: n/a
 
      16th Feb 2007
> 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


 
Reply With Quote
 
Joanna Carter [TeamB]
Guest
Posts: n/a
 
      17th Feb 2007
"Mike Labosh" <mlabosh_at_hotmail_dot_com> a écrit dans le message de news:
(E-Mail 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

--
Joanna Carter [TeamB]
Consultant Software Engineer


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Property Block Accessibility Mike Labosh Microsoft C# .NET 3 14th Jun 2007 11:19 PM
Help with MS Accessibility Pete Davis Microsoft Dot NET Framework 8 20th Jan 2005 10:34 PM
Property Accessors w/diff Accessibility?? A Traveler Microsoft VB .NET 3 30th Sep 2004 06:42 PM
accessibility.dll - what's it for? darrel Microsoft ASP .NET 0 29th Sep 2004 04:48 PM
The controls on this property sheet are disabled because one or more other Network property sheets are already open. To use these controls, close all these property sheets and then reopen this one. =?Utf-8?B?Um9iZXJ0?= Microsoft Windows 2000 Networking 1 11th Apr 2004 12:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:28 PM.