Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2005

Tip: Looking for answers? Try searching our database.

Scope of properties

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 30 Sep 2005 09:57 GMT
I would like to make the get method of a property public, but the set method
internal so that it is effectively read-only outside the assembly but
read-write within it (sort of the nearest thing to a C++ "friend"), is this
possible? Or is there some way of achieving the "friend" effect?
Signature

Dave

Oliver Sturm - 30 Sep 2005 11:05 GMT
>I would like to make the get method of a property public, but the set
>method
>internal so that it is effectively read-only outside the assembly but
>read-write within it (sort of the nearest thing to a C++ "friend"), is this
>possible? Or is there some way of achieving the "friend" effect?

This is possible to do in C# 2, like this:

  public int MyProperty {
    get {
      return val;
    }
    internal set {
      val = value;
    }
  }

If you don't use C# 2, I'd suggest you use an internal setter method (as
opposed to the property setter) instead.

               Oliver Sturm
Signature

Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Dave - 30 Sep 2005 11:41 GMT
Ah, that's interesting. Pardon my ignorance, but what is C# 2?

I have VS.NET 2003 (aka VS7.0) and .NET 1.1. I know that VS is now at 2005
(beta) and that .NET will shortly be at 2.0, codenamed "Longhorn", or is it
"Whidbey", no, hang on "Indigo", or was it "Yukon" - oh boy, you can see I'm
getting confused.

Clarification would be greatly appreciated.
Signature

Dave

> >I would like to make the get method of a property public, but the set
> >method
[quoted text clipped - 17 lines]
>
>                 Oliver Sturm
Oliver Sturm - 30 Sep 2005 12:06 GMT
>Ah, that's interesting. Pardon my ignorance, but what is C# 2?
>
[quoted text clipped - 3 lines]
>I'm
>getting confused.

These are a lot of very different things you mention :-)

C# 2 is the version that will be released with the upcoming VS.NET 2005
(and is now available in betas and various CTPs). It coincides with the
version of the .NET framework that's associated with the same release (and
which used to be called Whidbey a while back).

Longhorn is an operating system and should be released sometime during
2006, it doesn't have much to do with .NET, VS.NET or C# releases. Indigo
is a technology that was developed as part of Longhorn, even if it might
get ported back to XP. And Yukon is (or was?) the code name for the
upcoming release of SQL Server 2005.

Now, to get some confusion back - big talk right now is actually C# 3, not
2, and associated bits, because these were recently introduced to the
general public. The release of this _might_ coincide somehow with
Longhorn... ;-)

               Oliver Sturm
Signature

Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Dave - 30 Sep 2005 12:23 GMT
Thanks Oliver, that's starting to make sense.

>>version of the .NET framework that's associated with the same release (and which used to be called Whidbey a while back).<<
That's .NET 2.0 presumably.

My concern is this - I think I am correct that all XP SP2 installations have
.NET1.1 on them. However, if I wrote an application using VS2005 & .NET2.0
presumably it wouldn't necessarily run on .NET1.1.

Actually this leads me on to a bigger but related question (maybe I should
start a new thread): I am currently developing a C# .NET app (my first!). Is
it possible to include the .NET installation as part of the application
installation package so that users who don't have .NET (W98, XPSP1) or who
have an earlier version will be automatically upgraded? That would then solve
the above problem too.

Signature

Dave

> >Ah, that's interesting. Pardon my ignorance, but what is C# 2?
> >
[quoted text clipped - 23 lines]
>
>                 Oliver Sturm
Jon Skeet [C# MVP] - 30 Sep 2005 12:29 GMT
> My concern is this - I think I am correct that all XP SP2 installations have
> .NET1.1 on them.

No, not necessarily.

> However, if I wrote an application using VS2005 & .NET2.0
> presumably it wouldn't necessarily run on .NET1.1.

Indeed.

> Actually this leads me on to a bigger but related question (maybe I
> should start a new thread): I am currently developing a C# .NET app
> (my first!). Is it possible to include the .NET installation as part
> of the application installation package so that users who don't have
> .NET (W98, XPSP1) or who have an earlier version will be
> automatically upgraded? That would then solve the above problem too.

You can certainly include the runtime redistributable and automatically
install it - I believe the installation projects make it pretty easy to
do so, in fact. Of course, you end up with a larger install package -
you might want to provide two versions, one for people who are sure
they've got the right version of .NET already, and one which includes
the installer. If people won't be downloading your product off the net
though - or if your app is so large that an extra 20MB (or however
much) won't make much impact, it would be safer to always have it
available :)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jon Skeet [C# MVP] - 30 Sep 2005 12:17 GMT
> Ah, that's interesting. Pardon my ignorance, but what is C# 2?
>
> I have VS.NET 2003 (aka VS7.0) and .NET 1.1.

Not quite - VS.NET 2003 is VS7.1.

> I know that VS is now at 2005
> (beta) and that .NET will shortly be at 2.0, codenamed "Longhorn", or is it
> "Whidbey", no, hang on "Indigo", or was it "Yukon" - oh boy, you can see I'm
> getting confused.
>
> Clarification would be greatly appreciated.

Okay. C# 2.0 is coming out with .NET 2.0 on November 7th, as part of VS
2005 (Whidbey). At the same time, SQL Server 2005 (Yukon) will be
released.

Entirely separately, there's Vista/Longhorn, the new OS, which will
hopefully ship in 2006. Vista will have extra components in, currently
called "WinFX". It's currently unclear to me whether this constitutes
.NET 3.0 or not. Some of these components (WPF, previously known as
Avalon, WCF previously known as Indigo, and WWF) are being
"backported" to some earlier operating systems. I would imagine they'll
ship at around the same time as Vista, but I don't know for sure.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Dave - 30 Sep 2005 13:18 GMT
Who was it said "there are more questions than answers". Actually that's
great, but it's given me three more concepts to get my head round. - I've got
WPF (Windows Presentation Foundation - replaces Forms) and WCF (Windows
Communication Foundation, replaces remoting - I've just spent a good deal of
time and money on books learning remoting, I hope it wasn't wasted). But
what's WWF?

And why does Vista/Longhorn have TWO names??? (Don't bother, I don't care<G>)
Signature

Dave

> > Ah, that's interesting. Pardon my ignorance, but what is C# 2?
> >
[quoted text clipped - 20 lines]
> "backported" to some earlier operating systems. I would imagine they'll
> ship at around the same time as Vista, but I don't know for sure.
Jon Skeet [C# MVP] - 30 Sep 2005 14:05 GMT
> Who was it said "there are more questions than answers". Actually that's
> great, but it's given me three more concepts to get my head round. - I've got
> WPF (Windows Presentation Foundation - replaces Forms)

Well, Windows Forms will still exist.

> and WCF (Windows Communication Foundation, replaces remoting - I've
> just spent a good deal of time and money on books learning remoting,
> I hope it wasn't wasted).

Again, I don't think remoting is going to be removed, but WCF is
probably the preferred way to go.

> But what's WWF?

Windows Workflow Foundation. See
http://msdn.microsoft.com/windowsvista/building/workflow/

> And why does Vista/Longhorn have TWO names??? (Don't bother, I don't care<G>)

Longhorn was just the codename, just as Avalon was the codename for
WPF, etc.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Chris Dunaway - 30 Sep 2005 14:48 GMT
Jon wrote:
> > But what's WWF?
>
> Windows Workflow Foundation. See
> http://msdn.microsoft.com/windowsvista/building/workflow/

And here all this time I thought WWF = World Wrestling Federation!!
Bill Butler - 30 Sep 2005 14:59 GMT
> Jon wrote:
>> > But what's WWF?
[quoted text clipped - 3 lines]
>
> And here all this time I thought WWF = World Wrestling Federation!!

Nope...they got a Cease and Desist thingy  from the World Wildlife Fund (WWF)
and now they are the WWE = World Wrestling Entertainment.

So when will Microsoft get a  Cease and Desist thingy???  :^)

   Bill
Jon Skeet [C# MVP] - 30 Sep 2005 15:04 GMT
> Nope...they got a Cease and Desist thingy  from the World Wildlife Fund (WWF)
> and now they are the WWE = World Wrestling Entertainment.
>
> So when will Microsoft get a  Cease and Desist thingy???  :^)

... or when will the World Wildlife Fund? :)

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

SP - 30 Sep 2005 16:52 GMT
>> Nope...they got a Cease and Desist thingy  from the World Wildlife Fund
>> (WWF)
[quoted text clipped - 3 lines]
>
> ... or when will the World Wildlife Fund? :)

Perhaps Microsoft will just buy them to avoid the issue. Then they can sue
Apple for using wildlife names in operating systems (Mac OS X Tiger).

SP
Dan Neely - 30 Sep 2005 16:24 GMT
> Nope...they got a Cease and Desist thingy  from the World Wildlife Fund (WWF)
> and now they are the WWE = World Wrestling Entertainment.
>
> So when will Microsoft get a  Cease and Desist thingy???  :^)

If they're lawyer is smart he'll wait until after vista has shipped and
deamnd a 'licensing fee' that would cost MS less than recalling all the
existing retail packages.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.