Grrr... Posted before checking. Looks like my generic declaration was stripped for looking too much like XML. Specifically:
What's the type of 'q'? Well, in this case it's an System.Collections.Generic.IEnumerable<...>. What's that...? Well, it's an anonymous type containing two properties (Name, and Address) typed to whatever the statically known types of Customer.Name and Customer.Address are. Since there is no declaration that can express that, you can then use "var" to allow the compiler to take care of all of it.
There is no nececssity to use implicitly typed local variables in the example you provided. You can still declare such code as:
int i = 5; string s = "Hello"
The necessity for "var" comes from situations where you're using "Anonymous Types" which (as their title implies) have no nominal type that can be used in their declaration. A good example of that is:
var q = customers.Where(c => c.City == "Seattle").Select(c => new { c.Name, c.Address });
What's the type of 'q'? Well, in this case it's an System.Collections.Generic.IEnumerable. What's that...? Well, it's an anonymous type containing two properties (Name, and Address) typed to whatever the statically known types of Customer.Name and Customer.Address are. Since there is no declaration that can express that, you can then use "var" to allow the compiler to take care of all of it.
Several of the new Linq C# featuers include:
Extension methods - a convenient syntax invoking methods on a different type than what they were explicitly declared on.
Lambda expressions - those: c => c.Name, snippets above
Object Initializers - an expression based apprach to instantiating and initializing an object (that goes far beyond the existing "new" call of today).
Anonymous types - Shown above. the new {... } expression.
Expression Trees - My new fav features. Captures a C# expression into a strongly typed object that can then be passed to any consumer. This is how we can pass a C# expression (like the one shown above) to your DB of choice and allow it to generate SQL (or whatever it wants) optimized for their platform that can then run server side!
Read more about it from the links in the OP and also feel free to check out some of my blogs on the topic:
I've written a series of posts on the new Linq technologies we've just previewed. My focus has been on the C# aspect of it (as i'm a C# language developer), but i'll also be discussing DLinq and XLinq (XML oriented query and transform). I try to go beyond just discussing the what the new features are, to more of a "why this is a good thing?" approach and "what existing problems do the new features solve?" You can find the blog posts here:
One of the major problems we've found is that while you might be catching all checked exceptions you won't be aware of unchecked exceptions (like NullPointerExceptions). This disparity between checked/unchecked is the source of many bugs (how many times have you had an IndexOutOfBounds, ClassCast, or NullPointer exception thrown?). It's extremely difficult to cope with with interfaces (you end up with interfaces throwing extremely catch all exceptions like "IOException" for any method they might have). Any implementor can only throw that set of exceptions and needs to throw runtime exceptions versions of anything else.
Without a comprehensive solution that could address all the issues of checked exceptions it was felt that there was too much cost for too little benefit. If there was strong customer demand for this (which there isn't) we would revisit this decision again in the future.
What would those constant gaping holes in IIS would those be? Supplying evidence would be nice and I'd appreciate links please. From where i'm sitting it sure seems like IIS is quite secure and competitive (if not better) than the alternatives.
Baki: That is not how you would write the C# iterator, that is how you would write the C# iterator consumer. Consumption of iterators in both languages has been easy from the start using the while/for constructs. However, creating iterators is actually somewhat difficult in C# 1.0 with its cursor based iterators (.Current and.MoveNext) and even more difficult with java's.HasNext and.Next.
For example, take a tree structure and try to write an iterator for it in java. Now do the same in C#, what you'll see is code like this:
I found the article quite interesting, but lacking in supporting evidence for many claims. Specifically, he states that on both speed and efficiency (not quite sure the difference, but I'm guessing that he's referring to memory usage for the latter) ASP.NET is weak. I'd be interested to see comparisons showing the difference between equivalent sites written with PHP5 and ASP.NET to see the difference.
Also, he mentions (a few times) about IIS insecurities (at posts a link to bugtraq), however I'm unable to check since the site seems to be crawling. How does PHP5+Apache's security record compare to ASP.NET+IIS6?
Thats actually not what he envisioned. Or did you not read the article? What he envisioned was decoupling the information from the storage medium so that you wouldn't be so dependent on a flimsy disk with all the limitations brought about because of it.
If you'd read the article, you'd see that that wasn't the case:
If you consider that nowadays we have to carry around film and music on little silver discs and stick them in the computer, it's ridiculous," Gates said
He's not advocating dropping DVD for HD-DVD, he's advocating dropping it because he feels that the concept of media-based-media (no pun intended) is archaic.
"If you consider that nowadays we have to carry around film and music on little silver discs and stick them in the computer, it's ridiculous," Gates said in comments reproduced in German in the mass-circulation daily Bild.
"These things can scratch or simply get lost."
Gates' vision of television of the future was: "TV that will simply show what we want to see, when we want to see it.
I certainly hope he's right. I hate CDs and I'm trying to get them out of my life. They do scratch, I do lose them, and they're just annoying to use. The perfect system to me would be something similar to iTunes but which would remember everything I had purchased so that my music would be available anywhere I ever went. Like the now defunct mp3.com.
With the speed of network connections increasing at a phenomenal pace, I can easily see the same technologies being present for video. Just a few days ago I wanted to see Rounders and I found that the DVD was missing from its case. Aaaaaaaaaaaargh. What I would have given to just go into my HTPC scroll through a list of movies (maybe sorted by ranking so that Rounders would be near the top), find the one I want and just hit play.
I won't shed a tear if DVDs go and are replaced with what he's talking about.
Do you really think that the people designing the web sites for banks will be unaware of XP SP2? You can download the release candidate right now and test your web site against it.
I can't imagine any reputable site being broken by this when the final is released.
Using your car analogy, would you be upset if instead of a tiny warning label printed at the back of the battery tray, you got a big blinking light on your dashboard saying "go in for service!!" If a driver saw that and chose to ignore it, who would you be upset at?
This akin to how WindowsUpdate works. You get a notification that critical updates are available and that you really should install them to protect the computer.
Who's at fault when the user ignores those messages?
No software is bug free and issues will have to be fixed as time goes on. However, unless we're going to automatically install updates without asking the user first, then it's goign to be a process where the user needs to be involved in some way.
This is true with any OS. Imagine someone complaining that they got hacked on their linux distro of choice, afterwards when asked it turns out they never once ran anything like up2date, emerge, apt, etc. to make sure they had all the necessary software patches in place. Would you blame the distro for shipping with those bugs. You could, but you'd be ignoring the real fact that bugs are inevitable right now. Instead, you would teach the person that responsibility lies partly with them in keeping their computer safe. This is no different on a windows system. Teach users to keep their system up to date (all it takes is one click to make that completely automated!).
Bollucks. The hours are fantastic. I'm also given a tremendous amount of flexibility with my schedule. As long as I am getting my work done, then there are no qualms with doing things like working 40 hours in 4 days and taking a long vation, or working on a weekend and taking weekdays off, etc.
Microsoft doesn't care how many hours you work as long as you get your work done on (or ahead of) time. If you can do your workload in 30 or 20 (or hell, 10) hours then that's fine. However, boredom tends to sit in in that case and you usually find interesting things that you can then be doing in the meantime to help out customers.
Which group did you interview with and what was the interviewers name who told you that 60 hours was expected of you?
Google: "volume shadow copy".
Grrr... Posted before checking. Looks like my generic declaration was stripped for looking too much like XML. Specifically:
...? Well, it's an anonymous type containing two properties (Name, and Address) typed to whatever the statically known types of Customer.Name and Customer.Address are. Since there is no declaration that can express that, you can then use "var" to allow the compiler to take care of all of it.
What's the type of 'q'? Well, in this case it's an System.Collections.Generic.IEnumerable<...>. What's that
There is no nececssity to use implicitly typed local variables in the example you provided. You can still declare such code as:
int i = 5;
string s = "Hello"
The necessity for "var" comes from situations where you're using "Anonymous Types" which (as their title implies) have no nominal type that can be used in their declaration. A good example of that is:
var q = customers.Where(c => c.City == "Seattle").Select(c => new { c.Name, c.Address });
What's the type of 'q'? Well, in this case it's an System.Collections.Generic.IEnumerable. What's that
Several of the new Linq C# featuers include:
Read more about it from the links in the OP and also feel free to check out some of my blogs on the topic:
http://blogs.msdn.com/cyrusn/archive/2005/09/13/4
http://blogs.msdn.com/cyrusn/archive/2005/09/16/4
-- Cyrus (http://blogs.msdn.com/cyrusn)
I've written a series of posts on the new Linq technologies we've just previewed. My focus has been on the C# aspect of it (as i'm a C# language developer), but i'll also be discussing DLinq and XLinq (XML oriented query and transform). I try to go beyond just discussing the what the new features are, to more of a "why this is a good thing?" approach and "what existing problems do the new features solve?" You can find the blog posts here:
6 5390.aspx and6 9953.aspx
http://blogs.msdn.com/cyrusn/archive/2005/09/13/4
http://blogs.msdn.com/cyrusn/archive/2005/09/16/4
-- Cyrus (http://blogs.msdn.com/cyrusn)
One of the major problems we've found is that while you might be catching all checked exceptions you won't be aware of unchecked exceptions (like NullPointerExceptions). This disparity between checked/unchecked is the source of many bugs (how many times have you had an IndexOutOfBounds, ClassCast, or NullPointer exception thrown?). It's extremely difficult to cope with with interfaces (you end up with interfaces throwing extremely catch all exceptions like "IOException" for any method they might have). Any implementor can only throw that set of exceptions and needs to throw runtime exceptions versions of anything else.
Without a comprehensive solution that could address all the issues of checked exceptions it was felt that there was too much cost for too little benefit. If there was strong customer demand for this (which there isn't) we would revisit this decision again in the future.
-- Cyrus (http://blogs.msdn.com/cyrusn)
This was a very large customer request along with generics and the other enhancements we're bringing to the table.
-- Cyrus (http://blogs.msdn.com/cyrusn)
What would those constant gaping holes in IIS would those be? Supplying evidence would be nice and I'd appreciate links please. From where i'm sitting it sure seems like IIS is quite secure and competitive (if not better) than the alternatives.
-- Cyrus (http://blogs.msdn.com/cyrusn)
Could you post some links to back up your claim? Thanks!!
-- Cyrus (http://blogs.msdn.com/cyrusn)
For example, take a tree structure and try to write an iterator for it in java. Now do the same in C#, what you'll see is code like this:
Pretty simple to understand and to create.
-- Cyrus (http://blogs.msdn.com/cyrusn)
-- Cyrus (http://blogs.msdn.com/cyrusn)
Odd, i don't see the connection between working at MS in the MBU and posting anon...
Is that an MBU policy?
-- Cyrus (http://blogs.msdn.com/cyrusn)
I found the article quite interesting, but lacking in supporting evidence for many claims. Specifically, he states that on both speed and efficiency (not quite sure the difference, but I'm guessing that he's referring to memory usage for the latter) ASP.NET is weak. I'd be interested to see comparisons showing the difference between equivalent sites written with PHP5 and ASP.NET to see the difference.
Also, he mentions (a few times) about IIS insecurities (at posts a link to bugtraq), however I'm unable to check since the site seems to be crawling. How does PHP5+Apache's security record compare to ASP.NET+IIS6?
-- Cyrus (http://blogs.msdn.com/cyrusn)
Thats actually not what he envisioned. Or did you not read the article? What he envisioned was decoupling the information from the storage medium so that you wouldn't be so dependent on a flimsy disk with all the limitations brought about because of it.
-- Cyrus (http://blogs.msdn.com/cyrusn)
How would that be difficult to copy? At some point the image has to be displayed somewhere. What is to prevent capturing at that point and copying?
-- Cyrus (http://blogs.msdn.com/cyrusn)
He's not advocating dropping DVD for HD-DVD, he's advocating dropping it because he feels that the concept of media-based-media (no pun intended) is archaic.
-- Cyrus (http://blogs.msdn.com/cyrusn)
I certainly hope he's right. I hate CDs and I'm trying to get them out of my life. They do scratch, I do lose them, and they're just annoying to use. The perfect system to me would be something similar to iTunes but which would remember everything I had purchased so that my music would be available anywhere I ever went. Like the now defunct mp3.com.
With the speed of network connections increasing at a phenomenal pace, I can easily see the same technologies being present for video. Just a few days ago I wanted to see Rounders and I found that the DVD was missing from its case. Aaaaaaaaaaaargh. What I would have given to just go into my HTPC scroll through a list of movies (maybe sorted by ranking so that Rounders would be near the top), find the one I want and just hit play.
I won't shed a tear if DVDs go and are replaced with what he's talking about.
-- Cyrus (http://blogs.msdn.com/cyrusn)
Microsoft makes all its compilers available for free. You can find them all at http://msdn.microsoft.com
-- Cyrus (http://blogs.msdn.com/cyrusn)
Do you really think that the people designing the web sites for banks will be unaware of XP SP2? You can download the release candidate right now and test your web site against it.
I can't imagine any reputable site being broken by this when the final is released.
-- Cyrus (http://blogs.msdn.com/cyrusn)
Yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay !!
-- Cyrus (http://blogs.msdn.com/cyrusn)
Internet Explorer runs in Ring3.
-- Cyrus (http://blogs.msdn.com/cyrusn)
Using your car analogy, would you be upset if instead of a tiny warning label printed at the back of the battery tray, you got a big blinking light on your dashboard saying "go in for service!!" If a driver saw that and chose to ignore it, who would you be upset at?
This akin to how WindowsUpdate works. You get a notification that critical updates are available and that you really should install them to protect the computer.
Who's at fault when the user ignores those messages?
No software is bug free and issues will have to be fixed as time goes on. However, unless we're going to automatically install updates without asking the user first, then it's goign to be a process where the user needs to be involved in some way.
This is true with any OS. Imagine someone complaining that they got hacked on their linux distro of choice, afterwards when asked it turns out they never once ran anything like up2date, emerge, apt, etc. to make sure they had all the necessary software patches in place. Would you blame the distro for shipping with those bugs. You could, but you'd be ignoring the real fact that bugs are inevitable right now. Instead, you would teach the person that responsibility lies partly with them in keeping their computer safe. This is no different on a windows system. Teach users to keep their system up to date (all it takes is one click to make that completely automated!).
-- Cyrus (http://blogs.msdn.com/cyrusn)
If it was a bug then your support call would have been refunded: http://www.winnetmag.com/Article/ArticleID/14203/1 4203.html
-- Cyrus (http://blogs.msdn.com/cyrusn)
You can already get those features from 3rd parties like CrazyBrowser and from other plug-ins that are freely available.
Not to mention the fact that one can download Mozilla, FireFox, or any of a number of other browsers that give you this functionality.
Why is it a bad thing that different browsers have different functionality and people can go out and have a fine selection of software to choose from?
-- Cyrus (http://blogs.msdn.com/cyrusn)
Bollucks. The hours are fantastic. I'm also given a tremendous amount of flexibility with my schedule. As long as I am getting my work done, then there are no qualms with doing things like working 40 hours in 4 days and taking a long vation, or working on a weekend and taking weekdays off, etc.
Microsoft doesn't care how many hours you work as long as you get your work done on (or ahead of) time. If you can do your workload in 30 or 20 (or hell, 10) hours then that's fine. However, boredom tends to sit in in that case and you usually find interesting things that you can then be doing in the meantime to help out customers.
Which group did you interview with and what was the interviewers name who told you that 60 hours was expected of you?
-- Cyrus (http://blogs.msdn.com/cyrusn)