Finding code in the MSDN Library

At Tech Ed, one of the things we heard over and over is “More code!”  This is not a new comment. We hear it a lot and believe me we are trying to get the code you want (simpler, more complex, full downloadable sample) where you want it. But there are a few tricks to finding code already out there.

1. Use MSDN search

MSDN Search has a new feature which will show you which pages have code examples. It isn’t always 100% accurate but it is pretty good most of the time. For searching tips, see the blog post Tips and Tricks for searching for Silverlight content on MSDN and replace the word “Silverlight” with “WPF.” And for more info on MSDN URLs, see Too many pages with the same name.

MSDNSearch

2. Look for titles that start with “How To” or “Walkthrough”

We have two content types that are specifically intended to included code, not just words. In general, a “How To” is going to be a short topic showing you how to accomplish a (relatively) simple task. While a “Walkthrough” is usually going to be a long, step-by-step list of instructions that (usually) results in a full, running sample at the end.  Walkthroughs almost always have a downloadable sample that you can get.

Walkthrough

3. Look for Example sections in the Class Library

Whenever you land on what we call our reference topics (e.g.,  Control.Foreground Property (System.Windows.Controls)), the pages have a specific set of sections, including Syntax, Remarks and Examples. The syntax sections are all auto-generated so they are provided for your convenience. The authored content is in the Remarks, Examples and See Also. In addition to the example provided, WPF content uses a unique system where we can include “How To” topics in the reference pages. If we have linked to more than one, the first will appear as an example and you will find a table, way down at the bottom of the page which contains links to more code using this API. The See Also section frequently contains links to more useful content, so don’t forget to scroll to the bottom of the page when you are looking for help.

MoreCode

4. Take advantage of the various community sites that contain sample code.

We post all the full samples used in our documentation on code gallery. You can download one at a time or all of them from WPF Documentation Samples.

In addition to what we provide, there are several other places to look.

WindowsClient.Net provides starter kits and samples to get you started writing your applications.

MSDN Code Gallery contains a lot of sample apps provided by the community.

MSDN Blogs often have a lot of interesting code examples. Also note that when you use MSDN Search, it includes blog entries and uses the same “Includes Example Code” listed in #1.

 

And as always, you can get help with your code from the community (as well as a lot of people who work on WPF) on the Forums. And if you have requests, comments, issues, etc for our documentation, use the Feedback button (at the bottom of the page in Lightweight and the stars at the top in Classic MSDN view. And if you don’t know what I’m talking about see this post.

Margaret

Comments

  • Anonymous
    July 07, 2010
    I didn't know about the "Includes Example Code" business!