Raba - Defend your code RSS 2.0
# Wednesday, November 28, 2007

Here at Doron's post about Object Initializers he raised a question about the IL generated from the compiler while generating Object Initializer.

            //Object Initializer
           GeoPoint point1 = new GeoPoint() { 
                             X=22.555,
                             Y=36.444,
                             CoordinateSystem=GeographicCoordinateSystem.Wgs84 };
            //Associative Init
            GeoPoint point3 = new GeoPoint();
            point3.X = 22.555;
            point3.Y = 36.444;
            point3.CoordinateSystem= GeographicCoordinateSystem.Wgs84;

That two samples are not the same, this is because of not having an atomic assignment possibility at the second piece of code.
you can have further reading at Bart's blog post.

Enjoy.

Wednesday, November 28, 2007 6:08:08 AM (GMT Standard Time, UTC+00:00)  #    Comments [2] - Trackback
.Net 3.5 | C#3.0 | LINQ

Wednesday, November 28, 2007 8:42:16 PM (GMT Standard Time, UTC+00:00)
Cool, thanks for the tip.
Friday, November 30, 2007 8:24:48 AM (GMT Standard Time, UTC+00:00)
It's my pleasure.
Comments are closed.
Archive
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Shani Raba
Sign In
Statistics
Total Posts: 145
This Year: 0
This Month: 0
This Week: 0
Comments: 97
Cool Stuff
Add to Technorati Favorites
Themes
Pick a theme:
All Content © 2012, Shani Raba
DasBlog theme 'Business' created by Christoph De Baene (delarou)