Re: Memory usage
From: Daniel Moth (dmoth74_at_hotmail.com)
Date: 03/03/05
- Previous message: Daniel Moth: "Re: Forms - Menu Tree Problems"
- In reply to: Alex Feinman [MVP]: "Re: Memory usage"
- Next in thread: maark: "Re: Memory usage"
- Reply: maark: "Re: Memory usage"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 3 Mar 2005 21:14:02 -0000
Just making sure I was not missing a trick... your point is definitely
relevant... :)
Cheers
Daniel
-- http://www.danielmoth.com/Blog/ "Alex Feinman [MVP]" <public_news@alexfeinman.com> wrote in message news:eAlo7TCIFHA.3760@TK2MSFTNGP12.phx.gbl... > No, of course it doesn't. I should have said that. I totally agree with > you. > But, since the OP asked "Is there any difference in memory footprint > between the 2 following declarations", I thought my point would be > relevant > > > -- > Alex Feinman > --- > Visit http://www.opennetcf.org > "Daniel Moth" <dmoth74@hotmail.com> wrote in message > news:ePITYLCIFHA.3108@tk2msftngp13.phx.gbl... >> That is my understanding too. It basically creates a new Color object >> which since it is a valuetype is simply assigning some variables (based >> on a bunch of conditions, some shifting etc) so there is no heap >> allocations. >> >> That doesn't change the recommendation to go with the first approach >> though does it? >> >> Cheers >> Daniel >> -- >> http://www.danielmoth.com/Blog/ >> >> >> "Alex Feinman [MVP]" <public_news@alexfeinman.com> wrote in message >> news:ORbt4DCIFHA.3196@TK2MSFTNGP15.phx.gbl... >>> But color is a value type... >>> Woudn't the only difference be in a few lines of IL that stuff the RGB >>> values in the Color fields? >>> >>> -- >>> Alex Feinman >>> --- >>> Visit http://www.opennetcf.org >>> "Daniel Moth" <dmoth74@hotmail.com> wrote in message >>> news:OFOHkiBIFHA.3444@TK2MSFTNGP10.phx.gbl... >>>> Those two are different. >>>> >>>> The first one creates a color and returns *it* everytime you ask. >>>> The second creates a new color *every* time you ask >>>> >>>> Go with the first one. >>>> >>>> Cheers >>>> Daniel >>>> -- >>>> http://www.danielmoth.com/Blog/ >>>> >>>> >>>> "maark" <maark@discussions.microsoft.com> wrote in message >>>> news:E99A8856-BF0A-47EC-9867-CD921EE2FB9D@microsoft.com... >>>>> Platform: WinCE 4.2, C# >>>>> >>>>> Newbie question: >>>>> Is there any difference in memory footprint between the 2 following >>>>> declarations: >>>>> >>>>> public static Color FG_COLOR = Color.FromArgb(100,100,30); >>>>> >>>>> public static Color FgColor >>>>> { >>>>> get {return Color.FromArgb(100,100,30);} >>>>> } >>>>> >>>>> TIA, >>>>> >>>>> Mark >>>>> >>>>> >>>> >>> >> >
- Previous message: Daniel Moth: "Re: Forms - Menu Tree Problems"
- In reply to: Alex Feinman [MVP]: "Re: Memory usage"
- Next in thread: maark: "Re: Memory usage"
- Reply: maark: "Re: Memory usage"
- Messages sorted by: [ date ] [ thread ]