Skip to main content
gamedev.net
🔒 Locked

Simple C# syntax question

Started by Daniel Miller Mar 6, 2007 at 9:52 AM 2 replies 850+ views
Original Post
Daniel Miller
Daniel Miller
What is the syntax for having a property with a public get and a private/protected set?
Axiverse
Axiverse
public int Foo{    get {...}    internal set {...}}


you can replace it with your own modifiers and it should work on the get as well.
Daniel Miller
Daniel Miller
Thanks for the answer, for some reason I remember that not working a while ago. Maybe in C# 1.0? ++rating
SamLowry
SamLowry
Quote:
Original post by Daniel Miller
Thanks for the answer, for some reason I remember that not working a while ago. Maybe in C# 1.0? ++rating


Different visibility for the getter and setter is new in C# 2.0.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.