Welcome to MSDN Blogs Sign in | Join | Help

Charlie Speaking in Southern California

I will be presenting on C# and LINQ three times in Southern California next week at a series of user group meetings. The events will be held in the San Diego and the Los Angeles area. Lisa Feigenbaum will be flying down from Redmond with me, and she will do VB presentations at the same set of meetings.

The schedule is as follows:

I will be talking on C# 3.0 Best Practices and LINQ:

C# 3.0 introduces a number of new language features such as query expressions, lambda expressions, extension methods, automatically implemented properties, local type inference and more. These are all features that can improve the quality of your code. They also provide new opportunities for making mistakes This talk focuses on both the good and the bad: how to use and how not to use the new features of C#. Each feature will be introduced with a small example, and you should be able to follow the talk even if you are not already familiar with the new language constructs. The talk will also explore the theoretical underpinnings of LINQ.

Lisa will be speaking on Visual Basic 2008 IDE Tips and Tricks:

In this talk, we’ll show how to turn yourself into a Visual Studio 2008 guru with the new language and IDE features. Tips and tricks will include how to maximize your VB IntelliSense experience, leverage Refactoring features, and improve the performance of your query and XML code. We’ll explore integrated XML, and show how to navigate XML gotchas and express what you wish in fewer lines of code. With respect to LINQ we’ll go deep into best practices, pitfalls to avoid, and answers to most frequently asked questions

Tuesday Night:

Wednesday Night

  • Microsoft
  • Three Park Plaza, Suite 1800
  • Irvine, CA 92614

Thursday Night

  • American Honda Motors
  • Bldg 100, # 100-1E-13
  • 1919 Torrance Blvd
  • Torrance, CA 90501

 

Source and deck from the talk.

 

kick it on DotNetKicks.com
Posted by Charlie Calvert | 4 Comments
Filed under: , , ,

Managed Languages Team is Hiring

The C#, VB, F#, Python and Ruby teams are looking for program managers, developers and testers who want to come work at Microsoft. The languages I've listed are among the most popular in use today, and Microsoft is in the forefront of the innovations that are driving the future of computer language development. Though not all our plans public at this time, I can say that we are involved in developing many exciting new technologies. The C# team has just finished shipping LINQ, which is provides developers with a powerful new technology for querying data. F# is exciting new language which will ship in the near future. There is surge of energy in the development world about dynamic languages such as Ruby and Python, and of course VB is one of the most popular languages in the world, as it has been for many years and will continue to be in the future.

Perhaps the best reason to come work at Microsoft is the chance to become friends with other highly skilled engineers. Some of the most brilliant developers in the world work at Microsoft, and the general level of expertise inside the language buildings is very high. The chance to talk with the best engineers and to develop and drive these technologies represents a unique opportunity for developers to enhance their skills, learn about computer science, and get insights into the future of computing.

Here are few of the openings available. I will look to post more openings here as I learn about them:

kick it on DotNetKicks.com
Posted by Charlie Calvert | 1 Comments
Filed under: ,

LINQFarm: Understanding IEnumerable<T>, Part I

The IEnumerable<T> interface is a key part of LINQ to Objects and binds many of its different features together into a whole. This series of posts explains IEnumerable<T> and the role it plays in LINQ to Objects. If you hear people talking about IEnumerable<T>, and sometimes wished you better understood its significance, then you should find this text helpful.

Collections and IEnumerable<T>

Though LINQ to Objects can be used to query several C# types, it cannot be used against all your in-process data sources. Those that can be queried all support the IEnumerable<T> interface. These include the generic collections found in the System.Collections.Generic namespace. The commonly used types found in this namespace include List<T>, Stack<T>, LinkedList<T>, Queue<T>, Dictionary<TKey, Value> and Hashset<T>.

All of the collections in the System.Collections.Generic namespace support the IEnumerable<T> interface. Here, for instance, is the declaration for List<T>:

public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable

You will find IEnumerable<T> listed for all the other generic collections. It is no coincidence that these collections support IEnumerable<T>. Their implementation of this interface makes it possible to query them using LINQ to Objects.

LINQ to Objects and IEnumerable<T>

Consider the following simple LINQ query:

List<int> list = new List<int> { 1, 3, 2 };
// The LINQ Query expression
var query = from num in list
            where num < 3
            select num;
foreach (var item in query)
{
    Console.WriteLine(item);
}

The type IEnumerable<T> plays two key roles in this code.

  • The query expression has a data source called list which implements IEnumerable<T>. 
  • The query expression returns an instance of IEnumberable<T>.

Every LINQ to Objects query expression, including the one shown above, will begin with a line of this type:

from x in y

In each case, the data source represented by the variable y must support the IEnumerable<T> interface. As you have already seen, the list of integers shown in this example supports that interface.

The same query shown here could also be written as follows:

IEnumerable<int> query = from num in list
                         where num < 3
                         select num;

This code makes explicit the type of the variable returned by this query. As you can see, it is of type IEnumerable<int>. In practice, you will find that most LINQ to Objects queries return IEnumerable<T>, for some type T. The only exceptions are those that call a LINQ query operator that return a simple type, such as Count():

int number = (from num in list
              where num < 3
              select num).Count();

In this case the query returns an integer specifying the number of items in the list created by this query. LINQ queries that return a simple type like this are an exception to the rule that LINQ to Objects queries operate on class that implement IEnumerable<T> and return an instance that supports IEnumerable<T>.

Composable

The fact that LINQ to Objects queries both take and return IEnumerable<T> enables a key feature of LINQ called composability. Because LINQ queries are composable you can usually pass the result of one LINQ query to another LINQ query. This allows you to compose a series of queries that work together to achieve a single end:

List<int> list = new List<int> { 1, 3, 2 };

var query1 = from num in list
             where num < 3
             select num;

var query2 = from num in query1
             where num > 1
             select num;

var query3 = from num1 in query1
             from num2 in query2
             select num1 + num2;

Here the results of the first query are used as the data source for the second query, and the results of the first two queries are both used as data sources for the third query. If you print out the results of query3 with a foreach loop you get the numbers 3 and 4. Though it is not important to the current subject matter, you might have fun playing with the code to understand why these values are returned.

Summary

By now it should be clear to you that IEnumerable<T> plays a central role in LINQ to Objects. A typical LINQ to Objects query expression not only takes a class that implements IEnumerable<T> as its data source, but it also returns an instance of this same type. The fact that it takes and returns the same type enables a feature called composability.

The next logical question would be to ask why this type plays such a key role in LINQ to Objects. One simple answer would be that the creators of LINQ decided that it should be so, and hence it is so. But one can still ask why they picked this particular type. What is it about IEnumerable<T> that makes it a useful data source and return type for LINQ to Objects queries? The answer to that question will be found in the second part of this series of articles.

kick it on DotNetKicks.com
Posted by Charlie Calvert | 6 Comments
Filed under: , ,

Community Convergence XLIII

Welcome to the forty-third issue of Community Convergence. The last few weeks have been consumed by the 2008 MVP Summit. During that annual event about 150 C# MVPs and many MVPs from other disciplines descend on Redmond for a technical summit accompanied by fun and games at local restaurants and hotels. Below I include a summary of the event by Jeremy D. Miller. One of the highlights of the event is a day in which the C# MVPs hear directly from the team about our plans for the future.

Other recent news includes the release of the Visual LINQ Query Builder, a tool for helping developers compose LINQ queries. Mitsu Furuta and others have been working hard on this project, and it is great to finally see it available for download. It is a useful programming tool for all LINQ developers, and especially for those who are new to LINQ and want some help learning the syntax.

From the C# Team

Luca Bolognese

Kirill Osenkov

Charlie Calvert

From the C# Community

MSDN Blog

Dustin Campbell

Jeremy D. Miller

Mitsu

Scott Guthrie

Wriju

Daniel Fernandez

Charles Petzold

From the F# Team

Luke Hoban

Jomo Fisher

kick it on DotNetKicks.com

Charlie's Deck and Demos from his Essence of LINQ Talk

The sample programs and the slides from my Essence of LINQ talk are available on the Code Gallery LINQ Farm resource page.

kick it on DotNetKicks.com
Posted by Charlie Calvert | 2 Comments
Filed under: , ,

Upcoming Talks by Charlie

I will be giving a talk entitled The Essence of LINQ in Seattle and Milwaukee over the coming week.

Wisconsin .NET User Group

  • Date: Saturday, April 5, 2008
  • Event: Deeper in .NET 2008
  • Location: Milwaukee Marriott West

Seattle Netda User Group:

  • Date: Monday, April 7, 2008
  • Event: Web Developer Meeting
  • Location: Microsoft Building 40, Steptoe Room #1450

Talk Title: The Essence of LINQ

Abstract: Explore the essential technologies that establish LINQ as a unique and important new tool for developers who want to query data. By looking at a series of code samples, attendees will learn that LINQ is integrated, unitive, declarative, hierarchical, extensible, transformative, and composable. These principles illustrate why LINQ has quickly been established as an important new development technology. Other topics covered in the talk include deferred execution, lambda expressions, extension methods, expression trees and the IQueryable<T> and IEnumerable<T> interfaces. The goal of the talk is to give developers a practical understanding of why LINQ is useful, and how it can be used to improve our development process.

kick it on DotNetKicks.com
Posted by Charlie Calvert | 1 Comments
Filed under: ,

Community Convergence XLII

Welcome to the forty-second issue of Community Convergence. The last few weeks have found me working hard and late. We have had a successful internal C# community review, and that means I have been gathering statistics on all the projects we've been working on for the C# Community. I now have a deep statistical understanding of our forums, connect, developer center and blogs. I have also been studying internal projects that are not directly applicable to the broader community. What have I learned? I'm not sure, but I have a lot of statistical evidence to support it!

While assembling data for the review, I was confronted continuously by the strength of the C# community. Your interest in C# has fueled growth in the forums, the developer center and the blogs. That is a tribute to your interest in development, to your creativity, to your passion for the intricate and fascinating work that can be done with a C# compiler and a fully engaged imagination.

The one thing that does stand out from the review is how many intelligent, engaged people there are in the C# community. But you don't need to study our statistics to see that. All you need do is click through the links listed below in this week's edition of Community Convergence. Even when the C# team is heads down working on new code, stalwart community types like Eric Lippert and Ed Maurer can find time to engage us with interesting posts. Out in the broader C# community, I've found dazzling material from Tomas Petricek, Joe Duffy, Chuck J, Greg Young, and many others. Thank you all. Your great work is the real evidence of the health of the C# community.

From the C# Team

Eric Lippert

Ed Maurer

Kirill Osenkov

Charlie Calvert

From the C# Community

Tomas Petricek

Mohammed Hossam

Joe Duffy

Burton Smith
Chuck Jazdzewski

Greg Young

Scott Hanselman

Mitsu

Scot Guthrie

Mark Wisecarver

Charles Petzold

Leniel Macaferi

Downloads

Joseph Albahari

  • LINQPad is a free tool that lets you dynamically query SQL databases.

Microsoft

 

kick it on DotNetKicks.com

Anders Hejlsberg Film Festival: The C# and other VS Language Teams at the Movies

It's a bit rainy and snowy today in Redmond. What an excellent time to curl up by the fire and watch a movie! Here are some suggestions.

kick it on DotNetKicks.com
Posted by Charlie Calvert | 7 Comments
Filed under: , ,

Sample Code for Games, P2P Apps, Vista Tools, Web Services for Flickr, MySpace, Digg and YouTube

A number of interesting sample applications have been released for C#, VB and C++ developers over the last few months. These include

  • C# Sample code for building Peer 2 Peer applications on Vista
  • A C# toolkit for developing Facebook applications
  • C# interfaces for web services from Digg, YouTube, Amazon, Flickr and other popular sites
  • C# WPF tools
  • C++ Sample Games

Here are links to some of the most important of these toolkits:

Below you can see a WPF application for Peer to Peer Network programming.

PeerToPeer

FIgure 2:  An easy to build Peer to Peer application that allows you to chat, send file or share pictures over a network.

The Coding for Fun Developer Kit

This developer kit has code for controlling many powerful technologies that are built into Vista:

  • Bluetooth
  • Vista Contacts
  • Vista Calendar
  • Telephony
  • Desktop Search
  • Power Management

There are also a series of Web Services that you can use to interact with popular Internet destinations

  • Yahoo Traffic
  • Flickr
  • MySpace
  • Amazon.com
  • Craig's List
  • Delicious
  • Digg
  • YouTube

Below you can see one of the sample applications that comes with the Coding 4 Fun Developer Kit. I entered in the string "LINQ", and the application retrieved related links to books about LINQ found on Amazon.com.

Amazon

Figure 1: Clicking on the links in this demo application causes a browser to be launched that shows books on Amazon.com related to LINQ.

Vista Peer 2 Peer ToolKit

  • Build Peer to Peer Applications using drag and drop WinForms and WPF controls.
  • Build applications that stream video and music

 

kick it on DotNetKicks.com
Posted by Charlie Calvert | 4 Comments
Filed under: ,

Understanding the Technical Book Market

Mike Hendrickson from O'Reilly has published a survey of the technical book market. As when viewing the TIOBE site, I think it is wrong to extrapolate any broad conclusions about the development languages market from the data you see here. For instance, lots of developers are still writing batch files, it just so happens that the book-market for that syntax is small. Changes in the C/C++ market are slow, which means that developers stick with tried and true books for those very popular languages rather than rushing out to buy new texts. Nevertheless, it is instructive to at least view this data, especially if you happen to be interested in technical books or trends in the broader developer landscape.

It should come as no surprise that C# and Java are the biggest sellers with a respective 13 and 14 percent of the publishing market. Note, however, that over the last year Java books have decreased in sales by about 13%, while C# has increased by the same amount. JavaScript, PHP and C/C++ are the next largest sellers, with about 10% of the market each. All three of these latter languages have been losing their share of the publishing market over the last year. JavaScript is down 10%, while PHP and C/C++ are down 5%.

Well known languages that have been growing quickly include ActionScript, which is up 53%, Python, up 31%, and PowerShell which has come out of nowhere to claim 1% of the market. Some well known languages that have been losing market share are Visual Basic, which is off by 34%, vbscript, which is off by 30%, and perl, which is off by 23%. Ruby has 5% of the market, and has grown at a rate of 10%. SQL is up by 5%, VBA is off by 11%. Some of these numbers may simply reflect fluctuations due to release cycles, but others may represent trends in the publishing market.

There are some interesting details in the figures found in this article. My old favorite language, Delphi, sold a grand total of 126 units in 2007. F# sold 698 units, but I bet we will see that number grow quite a bit in 2008. The overall market is dominated by languages that run on some kind of virtual machine, with C/C++ being the only native language that is still selling broadly in the book market. Oh yes, I should also add that sales in the technical book market as a whole are off by about 1%. The web is a huge, and very hungry, machine.

Mike Hendrickson says that the information in his article is drawn "from Bookscan's weekly top 3,000 titles sold. Bookscan measures actual cash register sales in bookstores. In other words, if you buy a book it gets recorded in this data."

Remember, you should not draw too many conclusions based on this data. For book authors and publishers, this information has obvious value. For the rest of us, it is just a tantalizing peak into a market that is very difficult to understand. Only one thing is certain: the actual usage numbers for these languages is probably quite different from what you see in this article.

Key Links:

kick it on DotNetKicks.com
Posted by Charlie Calvert | 4 Comments
Filed under: ,

Preview of a C# 3.0 Book by Bruce Eckel and Jamie King

I mention the preview of their book that Jamie King and Bruce Eckel have made available as a free download on the MindView website in my latest Community Convergence post. However, I did not describe its contents, and so I thought I would take a moment to make sure that the community is aware of this very valuable resource.

The post is entitled C# Query Expressions And Supporting Features in C# 3.0, and it runs to 233 pages of text bound in a PDF file. Perhaps the simplest way to give you an idea of the scope of this document will be to show you the table of contents for the text you will download:

  • Preface 1
    • What makes this book stand out?..................... 1
    • Reading vs. Wrestling ...........2
    • The build system...................2
    • Reviews .................................4
    • Errors ....................................4
    • Source Code...........................4
    • Using this book
    • to teach a class.......................4
    • Dedications ...........................5
    • Jamie: .............................................5
  • Simple New Features 7
    • Extension methods................ 7
      • Inheritance vs. extension methods ........................11
      • Utilities for this book.................... 15
      • Extended delegates....................... 19
      • Other rules....................................20
    • Implicitly-typed local variables......................23
    • Automatic properties ..........25
    • Implicitly-typed arrays........28
    • Object initializers ................33
    • Collection initializers ..........35
    • Anonymous types................37
    • Lambda expressions............45
      • Func ..............................................50
  • Query Expressions 52
    • Basic LINQ..........................52
    • Translation..........................54
      • Degeneracy ...................................59
      • Chained where clauses ...............60
    • Introduction to Deferred Execution ............. 61
    • Multiple froms ...................63
    • Transparent identifiers ....... 71
      • Iteration Variable Scope...............73
    • More complex data..............78
    • let clauses ...........................83
    • Ordering data ......................86
    • Grouping data .....................89
    • Joining data.........................95
    • Nested Queries .................. 102
      • into.............................................. 105
      • let clause translations.................108
      • let vs. into....................................113
      • joining into ..................................115
      • Outer joins...................................121
    • Other query operators....... 126
  • Exercise Solutions 139
    Chapter 1 ........................... 139
    Chapter 2............................161

Clearly there is a great deal of useful information here. I think many developers will find this to be a great resource.

Elsewhere I mention the other great books that are coming out on LINQ. I'm calling this one out in more detail simply because it is a free resource that everyone can access immediately.

kick it on DotNetKicks.com
Posted by Charlie Calvert | 2 Comments
Filed under: ,

Community Convergence XLI

Welcome to the forty-first Community Convergence. The big news this week is that we have moved Future Focus, our peek at features that might appear in the next version of Visual Studio, to the Code Gallery. To seed our efforts on this new platform we have a new post on our plans for the IDE. This post covers a feature named the Call Hierarchy. I should perhaps add that in subsequent Future Focus posts you can expect to see us switch back and forth between our plans for the IDE, the C# language and other features. We want to mix up the issues we discuss, thereby insuring that all the major areas in the product are covered at one point or another. On a related note, I should mentioned that the IDE Dev Lead, Kevin Pilch-Bisson, is also looking for general feedback on features you'd like to see in the next version of the IDE.

When working on the C# Developer Center, my main collaborator on the MSDN side is Kerby Kuykendall, a tireless and talented worker who has done much to improve the way the Dev Centers look, and the degree of inter-action that we can expect when we visit it. We work together to bring in the community pieces that appear on the front page of the C# Dev Center, so I'll let him introduce the fascinating new article by Tomas Petricek on Calculating with Infinite Sequences.

I also want to announce the Visual Studio Gallery where you can find a collections of VS extensions, add-ins and third party tools. This is a sister project to Code Gallery. On Code Gallery you find samples and community related content, while the Visual Studio Gallery is designed to host extensions, particularly those developed by various ISVs. Ongoing projects that are frequently developed in collaboration with the community are found on CodePlex.

New from the C# Community

Eric Lippert

Sam Ng

Ed Mauer

Kevin Pilch-Bisson

Luca Bolegnese

Charlie Calvert

Various LINQ Posts

LINQ and Outlook

Wriju Ghosh

Downloads

Bruce Eckel

Other

Other Articles or Announcements of Note

Scott Guthrie

Scott Hanselman

Others

kick it on DotNetKicks.com

Future Focus II: Call Hierarchy

The success of the first Future Focus post has made it easy for us to continue sharing our plans for the future of the C# language. The intelligent and thoughtful suggestions we received from the community about the Dynamic Lookup feature have had a significant impact on the C# team's plans for future releases of C#. The quality of your input was very impressive, and we sincerely thank you for your contributions.

Last month we looked at a C# language feature called Dynamic Lookup. This month we switch our focus to the Visual Studio IDE as we investigate a new feature named Call Hierarchy. This feature will be implemented the same way for both C# and VB developers. We will therefore ask for comments from both communities.

Changes for Future Focus

Your suggestions on Dynamic Lookup influenced not only the C# language, but also Microsoft's plans for how we share information on future releases with the community. The management here at Microsoft believes that other teams will benefit from feedback similar to what was garnered from the Dynamic Lookup post. As a result, we have decided to continue our Future Focus discussions on the MSDN Code Gallery.

The Code Gallery is a good place for these discussions because it is language and team agnostic. My blog is directly associated with the C# team, and hence it is not the right place to share a discussion of the Call Hierarchy feature, which will be of interest to both the C# and the VB teams. We hope that other feature teams will also share their plans for future releases, and we feel that the Code Gallery is appropriate neutral ground on which they can share their ideas.

Code Gallery as a Discussion Forum

The Code Gallery is a location where many types of resources can be shared. Most of the resources on Code Gallery are sample programs. But the Gallery can also be used to host general discussions such as the type that occurs when we ask for feedback on our future plans.

The Code Gallery has a number of useful tools inside it, but it may take you a moment to become familiar with its structure. From the main page of the Code Gallery you can access the various resources stored on the site. If you go to the C# and Visual Basic Futures resource page, you will be able to read about and comment on our plans for these languages.

The futures resource features a set of tags which you can use to navigate through the site.

CodeGallery

The Home tab can be selected when you want to see an overview of all the discussions that will be hosted on the site. Right now you will be able to find two links, one to the Dynamic Lookup page on this blog, and one to the new page set up for a discussion of the Call Hierarchy on the Code Gallery:

DynamicLookup for C# (Jan 25, 2008)
Call Hierarchy for C and VB (Jan 25, 2008)

After reading about the Call Hierarchy, you will find links inside the article that point you to the appropriate discussion area. You can also click on the Discussions tab. There you will find one or more discussions, each marked by an icon:

CodeGallery01

Click on the text next to the icon in the the Code Gallery in order to enter the discussion. There you can provide the team with your feedback. On occasion, we may break out a discussion into a sub-topic on the Issue Tracker tab. There you will be able to drill into a particular issue in more depth, and cast votes for features that you like or dislike.

We ask that you refrain from starting a separate discussion on a particular topic unless there is a real need to do so. If you discover such a need, please use the tagging system to associate your new discussion with a particular topic. For instance, if you are starting a new discussion on the Call Hierarchy feature, then associate the "Call Hiearchy" tag with that discussion. I will try to monitor the site so I can offer help to people if they need or want it.

We Want your Feedback

I'm interested in hearing your feedback about both our plans for the future of C# and VB, and the way that we share this information with you. If you have comments on our plans for Call Hierarchy, please share them on Code Gallery. If you want to comment on the Future Focus project in general, and the recent move to Code Gallery in particular, please reply to this post. Thank you again for your suggestions, they are a valuable aid to the team as we work on the development of future versions of the C# language.

kick it on DotNetKicks.com

New and Updated Live API's for Web Developers

A series of new or updated API's that developers can use for building web applications are available from the Windows Live Dev site. The new services and API's are listed below. Go to Dave Treadwell's post to read about them in more detail.

New or Updated Windows Live Platform Services

  • Developer Tools – Windows Live Tools for Microsoft Visual Studio
  • Windows Live Messenger Library
  • Contacts API
  • Silverlight Streaming
  • Windows Live ID Delegated Authentication
  • Atom Publishing Protocol (AtomPub)
  • Application Based Storage

New or Updated Windows Live Quick Applicatin Updates

  • Visit Planner
  • Tafiti Search Visualization

Key Links for Windows Live Dev Updates

kick it on DotNetKicks.com
Posted by Charlie Calvert | 3 Comments
Filed under:

Link to Everything: A List of LINQ Providers

I've recently updated the list of LINQ Providers found on my Links to LINQ page, accessible from the News section on the left of this blog. I'm sure there are other providers available. Feel free to write me or append a comment if you want to add to this list.

Below you see the current state of my LINQ providers list, as of Feb 28, 2008. I will maintain this list on my Links to LINQ page, so check there for updates.

LINQ Providers

kick it on DotNetKicks.com
Posted by Charlie Calvert | 29 Comments
Filed under: ,
More Posts Next page »
 
Page view tracker