Click here to Skip to main content
15,905,414 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dialog result Question Pin
PIEBALDconsult4-May-08 5:04
mvePIEBALDconsult4-May-08 5:04 
GeneralRe: Dialog result Question Pin
Luc Pattyn4-May-08 11:44
sitebuilderLuc Pattyn4-May-08 11:44 
QuestionProblem with get set Pin
Saba023-May-08 4:01
Saba023-May-08 4:01 
AnswerRe: Problem with get set Pin
snorkie3-May-08 4:05
professionalsnorkie3-May-08 4:05 
AnswerRe: Problem with get set Pin
Saba023-May-08 4:23
Saba023-May-08 4:23 
QuestionADO.Net, DataGridView and Concurrency Pin
paas3-May-08 4:01
paas3-May-08 4:01 
AnswerRe: ADO.Net, DataGridView and Concurrency Pin
Rob Graham3-May-08 4:52
Rob Graham3-May-08 4:52 
AnswerRe: ADO.Net, DataGridView and Concurrency Pin
Giorgi Dalakishvili3-May-08 5:37
mentorGiorgi Dalakishvili3-May-08 5:37 
GeneralRe: ADO.Net, DataGridView and Concurrency Pin
Rob Graham3-May-08 6:20
Rob Graham3-May-08 6:20 
QuestionStackOverFlowException error in C# Pin
ADTC#3-May-08 3:32
ADTC#3-May-08 3:32 
AnswerRe: StackOverFlowException error in C# Pin
adamzhang3-May-08 3:45
adamzhang3-May-08 3:45 
AnswerRe: StackOverFlowException error in C# Pin
Jimmanuel3-May-08 4:13
Jimmanuel3-May-08 4:13 
AnswerRe: StackOverFlowException error in C# Pin
User 66583-May-08 5:34
User 66583-May-08 5:34 
AnswerRe: StackOverFlowException error in C# Pin
Luc Pattyn3-May-08 5:35
sitebuilderLuc Pattyn3-May-08 5:35 
Questionderive from IEnumerator<t></t> Pin
George_George3-May-08 3:28
George_George3-May-08 3:28 
AnswerRe: derive from IEnumerator Pin
adamzhang3-May-08 3:49
adamzhang3-May-08 3:49 
GeneralRe: derive from IEnumerator Pin
George_George3-May-08 4:00
George_George3-May-08 4:00 
AnswerRe: derive from IEnumerator Pin
Pete O'Hanlon3-May-08 9:49
mvePete O'Hanlon3-May-08 9:49 
GeneralRe: derive from IEnumerator Pin
George_George3-May-08 19:40
George_George3-May-08 19:40 
GeneralRe: derive from IEnumerator Pin
Roger Alsing4-May-08 8:20
Roger Alsing4-May-08 8:20 
GeneralRe: derive from IEnumerator Pin
George_George6-May-08 3:07
George_George6-May-08 3:07 
Questionprivate/public get/set Pin
George_George3-May-08 2:51
George_George3-May-08 2:51 
Hello everyone,


New to C#, a simple question which my book does not cover.

If we do not specify the public/private access of get/set, then it is of the same as the public/private access to the property itself, but we can overwrite it.

For example, in the following code, in get method, when we do not specify public/private, it will be automatically the same as the property Abc, which makes get public, but in set, we can overwrite it to make it private?

public class MyList
{

    class Foo
    {
        private int _abc;

        public int Abc
        {
            get
            {
                return _abc;
            }
            private set
            {
                _abc = value;
            }
        }

    }

    static void Main()
    {
        Foo f = new Foo();
        return;
    }
}



thanks in advance,
George
AnswerRe: private/public get/set Pin
#realJSOP3-May-08 3:17
professional#realJSOP3-May-08 3:17 
GeneralRe: private/public get/set Pin
George_George3-May-08 3:19
George_George3-May-08 3:19 
GeneralRe: private/public get/set Pin
adamzhang3-May-08 3:54
adamzhang3-May-08 3:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.