🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.pl.comp.lang.csharp
3 messages
3 total messages Started by marcin Sat, 12 Dec 2009 21:29
Pytanie dot. akcesorów
#21276
Author: marcin
Date: Sat, 12 Dec 2009 21:29
34 lines
1494 bytes
Witam,

Krótkie pytanie. Mam kod:

--
    class Test
    {
        public Rectangle Bounds { get; set; }


        public Test()
        {
        }
    }


          Test test = new Test();
          test.Bounds.Offset(2, 2);
--

Wywołanie metody Offset() nie zapisuje stanu. Czy wynika to z faktu, ze 
akcesor zwraca tak naprawdę kopię pola Bounds?


-- 
Pozdrawiam
Marcin 


__________ Informacja programu ESET Smart Security, wersja bazy sygnatur wirusow 4682 (20091212) __________

Wiadomosc zostala sprawdzona przez program ESET Smart Security.

http://www.eset.pl lub http://www.eset.com 
Re: Pytanie dot. akcesorów
#21277
Author: Łukasz 'Maly' Ostrowski
Date: Sun, 13 Dec 2009 11:55
13 lines
1262 bytes
On Sat, 12 Dec 2009 22:29:28 +0100, marcin wrote:

> Wywołanie metody Offset() nie zapisuje stanu. Czy wynika to z faktu, ze 
> akcesor zwraca tak naprawdę kopię pola Bounds?

Tak. Rectangle jest struct'em, value-type, jest zwracany jako
kopia z gettera.

-- 
Pozdrawiam,
Łukasz 'Maly' Ostrowski.      http://l3v.pl/
ICQ: 148498663     GG: 2544385      AIM: malyzgora
GTalk: l3vi4than@gmail.com        ASTRA: L3viathan
Re: Pytanie dot. akcesorów
#21278
Author: marcin
Date: Sun, 13 Dec 2009 13:20
24 lines
1698 bytes
Użytkownik "Łukasz 'Maly' Ostrowski" <maly@USUNnemo.pl> napisał w wiadomości 
news:16wftppi7gstd$.1h0l0dfx27lnp.dlg@40tude.net...
> On Sat, 12 Dec 2009 22:29:28 +0100, marcin wrote:
>
>> Wywołanie metody Offset() nie zapisuje stanu. Czy wynika to z faktu, ze
>> akcesor zwraca tak naprawdę kopię pola Bounds?
>
> Tak. Rectangle jest struct'em, value-type, jest zwracany jako
> kopia z gettera.
>

Dziękuję.

-- 
Pozdrawiam
Marcin 


__________ Informacja programu ESET Smart Security, wersja bazy sygnatur wirusow 4683 (20091213) __________

Wiadomosc zostala sprawdzona przez program ESET Smart Security.

http://www.eset.pl lub http://www.eset.com 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads