Search Wiki:

CSharp Samples for Visual Studio 2008

Our first release on CodeGallery contains updates to the official C# samples that ship with Visual Studio 2008.

Language Samples

Please turn to the releases page to download the samples.

We have created a set of language samples to help you get familiar with various C# language features. They are available in the LanguageSamples folder.

LINQ Samples

We have created four sets of samples for you that are designed to help you learn LINQ quickly, and to act as a reference and guide for those with more advanced skills. A few handy utilities are also included.

Getting Started with LINQ

SampleQueries: This is the most important sample and contains about 500 examples of how to use each of the query operators in LINQ to Objects, LINQ to SQL, LINQ to XML and LINQ to DataSet.
SimpleLinqToObjects: The hello world of the LINQ samples. This shows you how easy it is to do simple queries of in-memory objects using LINQ to Objects.
LinqToNorthwind: A basic example of how to use LINQ To SQL to query a database.
SimpleLinqToXml: Get started using LINQ to XML.
WinFormsDataBinding: Learn how to display LINQ queries with grids in a Windows form. It includes a one to many query example.
XQuery: Another simple LINQ to XML sample query. This sample shows the minimal code necessary to write a LINQ to XML query
LinqToXmlDataBinding: Bind LINQ to XML code to WPF controls.

Advanced Samples

DynamicQuery: Code to create LINQ queries at run time.
Reflector: Use LINQ to right queries against the objects in your code using the Reflection APIs.
RSS: This sample acts as a tiny web server that aggregates several RSS feeds
SimpleLambdas: Several examples of how to write and use lambda expressions.
WebServiceLinqProvider: A sample showing how to create a LINQ provider to query Terraserver, a web service offering geographical data.

Addins and Visualizers

ExpressionTreeVisualizer: Create a visualization of an Expression Tree.
QueryVisualizer: Allows LINQ to SQL developers to see the SQL for their query, and also to see the results of the query in a grid.
PasteXmlAsLinq: A Visual Studio addin that automatically converts XML markup to LINQ to XML code. Note: Addins cannot be compiled or loaded within C# Express.

Libraries or Utilities

Data: Contains XML files and a modified copy of the Northwind database for use by several of the other samples.
ObjectDumper: A utility for writing the output from a LINQ query to the screen in text mode.
NorthwindMapping: Contains the ORM mapping created by the LINQ to SQL designer for the Northwind database that ships with these samples. It is used by DynamicQuery and WinFormsDataBinding.
Whitepapers: The following papers are stored in this directory in Word format:
  • LINQ Project Overview
  • LINQ to SQL Overview for C# and VB
  • Standard Query Operators
  • LINQ to XML Overview
Last edited May 20 at 7:37 PM  by CharlieCalvert, version 17
Comments
Haluk wrote  Jan 25 at 9:38 AM  
how nice ...

dlambert wrote  Jan 28 at 8:49 PM  
Ok, I give up. Are there supposed to be links here?

RomSteady wrote  Jan 29 at 3:10 PM  
DLambert, the links are on the "Releases" tab.

marlongrech wrote  Feb 2 at 9:41 PM  
thank you so much for this :D

Rapund wrote  Feb 5 at 10:37 PM  
I believe that many were in need of something like this...

Weitzhandler wrote  Feb 23 at 5:05 PM  
psssssssss, now I know C# really professional!
Jump to here if you want to learn C# in just-a-second as me:
http://code.msdn.microsoft.com/csharpsamples

daveib wrote  Feb 27 at 9:18 PM  
Wow!!! This is really stupid for Microsoft! I'm totally surprised. Usually Microsoft does things in a little more professional manner. Why not allow us to search for what we are actually looking for rather than making us download the entire set of libraries and try to sift through that???

Dmitry wrote  Feb 29 at 9:34 PM  
I downloaded it in about 10 seconds and its organized well enough that its not as big of an issue as you make it sound daveib.

In the future it would be nice to have a feature that allows you to search through the source code without downloading it all but considering this site is new, its not a bad implementation at all.

tomask wrote  Mar 7 at 10:58 AM  
Where is very interesting logic programming sample, which was in CTP?

Greycoder wrote  Mar 8 at 4:44 PM  
This is dumb. They get rid of GotDotNet with it's thousands of samples/examples/ listserver/ references etc. and replace it with a small zip file download to add and fix LINQ programming samples in VS 2008. What a screw up! How embarassing for Microsoft. I'd be humiliated to learn how someone did this. I'm surprised theres not more info on Silverlight as well , I'd almost wonder if this was a misguided marketting ploy, or an innocent idea gone badly wrong (like someone please update the links everywhere to add a link to VS 2008 sample source updates ) turned into (delete all community reference services and point them to a LINQ sample code update page!)

bongjun wrote  Mar 12 at 4:45 AM  
???

ammigarg wrote  Mar 18 at 7:05 PM  
thanks !

quantor wrote  Mar 24 at 7:39 PM  
Cool, this is exactly what I was looking for! I agree with daveib to a certain extent. Don't get me wrong, I like the content but It would be nice if you could search through and take what you want rather than downloading a .zip

segFault wrote  Mar 24 at 5:52 PM  
many thanks for this - could we have some silverlight 2.0 examples please.

lwc wrote  Mar 25 at 6:34 AM  
where

Miller wrote  Mar 25 at 6:43 AM  
I can't see anything...

mycroo wrote  Mar 27 at 11:15 AM  
i also can't see anything ,i want to get the examples codes

nurlanbek wrote  Apr 4 at 12:41 PM  
hani nerde :) where???

Crazy wrote  Apr 8 at 8:42 AM  
????,??????? I will be crazy!!!I see nothing

KenH wrote  Apr 11 at 4:38 PM  
For those of you that "see nothing", the downloads are on a different "Tab". You have to understand. This is Microsoft. They rule the world, when it comes to having "Hall of Shame" class User Interfaces.

rickj wrote  Apr 18 at 6:41 PM  
For those of us that are just starting out this is the best way sifting through is fine if you know exactly what your looking for
these samples give me enough to work with I'll be good enough at it by the time I get to what I'm looking for I'll have it mastered
thanks guys

hetthatroi wrote  Apr 29 at 11:54 PM  
Really appreciate the SampleQueries.exe!!! thx a lot

bamo wrote  Apr 30 at 2:44 PM  
how i can download c# 2008 samples

bamo wrote  Apr 30 at 2:49 PM  
i have too difficult for me download c# 2008 samples i need help please

bamo wrote  Apr 30 at 2:51 PM  
that's all problem issolved
it is OK

dheeru2u wrote  May 5 at 6:45 AM  
where are the examples ?

MarlonRibunal wrote  May 12 at 11:52 PM  
These samples are great jumpstart solutions for novices and professionals who have been working with the old versions!

koud wrote  Jun 23 at 4:43 PM  
gffg

karateKid wrote  Wed at 8:22 PM  
where from should I download LINQ samples?

karateKid wrote  Wed at 8:29 PM  
anybody?

Updating...
Page view tracker