---
title: "Code Generation using LINQ Expression Trees and .NET 3.0"
url: "https://osherove.com/blog/2007/3/4/code-generation-using-linq-expression-trees-and-net-30.md"
canonical: "https://osherove.com/blog/2007/3/4/code-generation-using-linq-expression-trees-and-net-30.html"
published: "2007-03-04T06:41:41"
updated: "2007-03-04T06:41:41"
tags: [".NET", ".Net 2.0", "C#"]
author: "Roy Osherove"
description: "via this thread on theServerSide I found this very interesting blog which talks a lot about C# 3.0 news features, including deep hacks and tricks using LINQ and Expression trees in .NET 3.0. For example, he shows how to…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Code Generation using LINQ Expression Trees and .NET 3.0

By Roy Osherove March 4, 2007 In [.NET](https://osherove.com/blog/category/net), [.Net 2.0](https://osherove.com/blog/category/net-2-0), [C#](https://osherove.com/blog/category/c)

**Historical article** · Originally published March 4, 2007; technical details may be outdated.

via [this thread](http://www.theserverside.net/news/thread.tss?thread_id=44332) on theServerSide I found this [very interesting blog](http://themechanicalbride.blogspot.com/index.html) which talks a lot about C# 3.0 news features, including deep hacks and tricks using LINQ and Expression trees in .NET 3.0.

For example, he shows how [to do code generation](http://themechanicalbride.blogspot.com/2007/02/do-you-know-linq-fu.html) using the Expression tree API instead of using IL, CodeDOM or anything else. Very interesting!

## More in .NET

[All posts in .NET](https://osherove.com/blog/category/net)

- Jun 5, 2007

    ### [Running Matlab, Python and Tcl scripts from .NET](https://osherove.com/blog/2007/6/5/running-matlab-python-and-tcl-scripts-from-net.html)

- May 19, 2007

    ### [Easier Winform UI Thread Safe Methods with DynamicProxy2 and Osherove.SimpleInterception](https://osherove.com/blog/2007/5/19/easier-winform-ui-thread-safe-methods-with-dynamicproxy2-and.html)

- Feb 25, 2007

    ### [FxCop is heading in the wrong direction - No testability whatsoever](https://osherove.com/blog/2007/2/25/fxcop-is-heading-in-the-wrong-direction-no-testability-whats.html)

- Feb 24, 2007

    ### [Introducing FxCopUnit - A framework for integrated FxCop rule testing](https://osherove.com/blog/2007/2/24/introducing-fxcopunit-a-framework-for-integrated-fxcop-rule.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
