Click here to Skip to main content
12,559,235 members (44,612 online)
Click here to Skip to main content


34 bookmarked

Poor Man's LINQ in Visual Studio 2005

, 28 Oct 2010 MIT
A way to use LINQ to Objects in C# 2.0 with .NET Framework 2.0
using System;
using System.Collections.Generic;
using System.Text;
using Compatibility.Linq;

namespace Demo
	class Program
		public static PoorMansLinq<T> Linq<T>(IEnumerable<T> source)
			return new PoorMansLinq<T>(source);
		public static void Main(string[] args)
			string[] words = new string[] { "Pies", "Are", "Good", "In", "Lovely", "Apples" };
			// Pies Are Good
			Console.WriteLine(string.Join(" ", Linq(words).Take(3).ToArray()));
			// Apples Are Good In Lovely Pies
			Console.WriteLine(string.Join(" ", Linq(words).Sorted().ToArray()));

			int[] numbers = new int[] { 4, 95, 309, 357, 233, 2 };
			// 1000
			// 666
				.Where(delegate(int x) { return x > 300; })));

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The MIT License


About the Author

Software Developer None
Canada Canada
Since I started programming when I was 11, I wrote the SNES emulator "SNEqr", the FastNav mapping component, LLLPG, and LES: XML for code, among other things. Now I'm old.

In my spare time I work on the Language of your choice (Loyc) initiative, which is about investigating ways to improve interoperability between programming languages, and includes Enhanced C# and LeMP, its Lexical Macro Processor.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.161026.1 | Last Updated 29 Oct 2010
Article Copyright 2008 by Qwertie
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid