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 Download Link

Please click here or turn to the downloads 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 Jul 17 2008 at 1:05 AM  by CharlieCalvert, version 21
Comments
Haluk wrote  Jan 25 2008 at 12:38 PM  
how nice ...

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

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

marlongrech wrote  Feb 3 2008 at 12:41 AM  
thank you so much for this :D

Rapund wrote  Feb 6 2008 at 1:37 AM  
I believe that many were in need of something like this...

Weitzhandler wrote  Feb 23 2008 at 8: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 28 2008 at 12:18 AM  
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  Mar 1 2008 at 12:34 AM  
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 2008 at 1:58 PM  
Where is very interesting logic programming sample, which was in CTP?

Greycoder wrote  Mar 8 2008 at 7: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 2008 at 7:45 AM  
???

ammigarg wrote  Mar 18 2008 at 10:05 PM  
thanks !

quantor wrote  Mar 24 2008 at 10: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 2008 at 8:52 PM  
many thanks for this - could we have some silverlight 2.0 examples please.

lwc wrote  Mar 25 2008 at 9:34 AM  
where

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

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

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

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

KenH wrote  Apr 11 2008 at 7: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 2008 at 9: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 30 2008 at 2:54 AM  
Really appreciate the SampleQueries.exe!!! thx a lot

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

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

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

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

MarlonRibunal wrote  May 13 2008 at 2:52 AM  
These samples are great jumpstart solutions for novices and professionals who have been working with the old versions!

koud wrote  Jun 23 2008 at 7:43 PM  
gffg

karateKid wrote  Jul 2 2008 at 11:22 PM  
where from should I download LINQ samples?

karateKid wrote  Jul 2 2008 at 11:29 PM  
anybody?

CharlieCalvert wrote  Jul 17 2008 at 12:53 AM  
To download the samples, you need to click on the downloads tab near the top of this page.

anilakkadjk wrote  Oct 21 2008 at 1:06 PM  
Very useful and great stuff!

Azumi wrote  Nov 22 2008 at 2:22 PM  
Tesekkürler...

Oop wrote  Dec 17 2008 at 2:33 PM  
Wonderful for us noobs! Thank you.

Sase wrote  Jan 20 at 2:41 PM  
This is very good
thanks

blad3runn69 wrote  Jan 28 at 5:25 AM  
cool stuff, thank you very much :)

Jaewon wrote  Jan 29 at 8:58 AM  
wow! it's more long comments then korea... (I'm korean)(If it sentence is wrong I'm sorry)

giz_li_ay wrote  Mar 3 at 9:23 AM  
Allah Razi Olsun ..Emeginize Saglik..Paylastikça Dünya Güzellesecek!!!!!

Dorne wrote  Mar 17 at 7:18 AM  
it helps me to gain more knowledge from you guys thanks alot!

ct_taylor wrote  Mar 18 at 4:37 PM  
Looks like the start of a good idea. How ever it is still mind boggling to me why Microsoft tech writers struggle so much to make help and sample code intuitive and user friendly.

tzhepiezo wrote  May 14 at 1:30 PM  
can anyone please help me out with a sample of a C# mobile application. please. you can contact me on tzhepiezo@hotmail.com

husteric wrote  May 28 at 4:28 AM  
thanks alot!

zakizakaria69 wrote  May 28 at 7:21 PM  
actually I often use custom ORM, BLL, and DAL, and using provider pattern for my application. I hope I could use LINQ to ease my data provider for XML datasource and maybe other non-Microsoft data source coz LINQ is using standard SQL. Hope so..I have yet to read...anyway very good work from Microsoft. You really have managed your technology very well. Not like Open Source projects....a lot of them are not properly managed and imbalanced...sorry guys.

dshizzel wrote  Jun 13 at 9:39 PM  
How about some of you mokes learn to read and write English for a change?

Updating...
Page view tracker