C#

Facebook Twitter

Threading

Microsoft Type Design Guildelines. From the CLR perspective, there are only two categories of types—reference types and value types—but for the purpose of a discussion about framework design, we divide types into more logical groups, each with its own specific design rules.

Microsoft Type Design Guildelines

Classes are the general case of reference types. They make up the bulk of types in the majority of frameworks. Classes owe their popularity to the rich set of object-oriented features they support and to their general applicability.

LINQ

Tree<T>: Implementing a Non-Binary Tree in C# « Critical Development. Download the Source [This is the first article in a series of intelligent data structures, which is continued here with KeyedList.]

Tree<T>: Implementing a Non-Binary Tree in C# « Critical Development

I’ve always thought it was odd that the .NET Framework never shipped with a Tree or Tree<T> class in its collection namespaces. Most of the other classic data structures are there: List, Dictionary, Stack, Queue, and so on. Where then is Tree<T>? I have no idea, but finding myself in need of one, I decided to build one, and in doing so realized that it was a little trickier than I first imagined it would be. Asynchronous Programming - Easier Asynchronous Programming with the New Visual Studio Async CTP. Imagine what the world would be like if people worked the same way as computer programs: void ServeBreakfast(Customer diner){ var order = ObtainOrder(diner); var ingredients = ObtainIngredients(order); var recipe = ObtainRecipe(order); var meal = recipe.Prepare(ingredients); diner.Give(meal);} Each subroutine can, of course, be broken down further; preparing the meal might involve heating pans, cooking omelets and toasting bread.

Were humans to perform these sorts of tasks like typical computer programs, we’d carefully write down everything as sequences of hierarchical tasks in a checklist and obsessively ensure that each job was complete before embarking on the next. A subroutine-based approach seems reasonable—you can’t cook the eggs before you get the order—but in fact it both wastes time and makes the application appear unresponsive.

It wastes time because you want the bread to be toasting while the eggs are frying, not after the eggs are done and getting cold. Reflection Overview. Dynamic in C# 4.0: Introducing the ExpandoObject - C# Frequently Asked Questions. Well, where else can you use this new feature? What are the use cases? Where does dynamic dispatch work better than static typing? The quick answer is that whenever you see syntax like myobject.GetProperty("Address"), you have a use case for dynamic objects. First of all, the above syntax is difficult to read.

Second, you don’t have any IntelliSense support for the property name, and if the “Address” property doesn’t exist you get a run-time exception. Impromptu-interface - ImpromptuInterface: Static interface to dynamic implementation (duck casting). That and more using the DLR. This Project has been moved to GitHub: C# 4.0 (.net & silverlight) framework to allow you to wrap any object (static or dynamic) with a static interface even though it didn't inherit from it.

impromptu-interface - ImpromptuInterface: Static interface to dynamic implementation (duck casting). That and more using the DLR.

It does this by emitting cached dynamic binding code inside a proxy. By expanding on the DLR plumbing used to implement this library, it has grown to support more general dynamic implementations. Unusual uses of ExpandoObject in C# 4 : Reed Copsey, Jr. Posted by Reed on Friday, November 6, 2009 · 7 Comments Most of the examples for using ExpandoObject basically demonstrate a replacement for a Hashtable or Dictionary<string,object>, but with a “nicer” syntax.

Unusual uses of ExpandoObject in C# 4 : Reed Copsey, Jr.

For example, Alexandra Rusina blogged about using ExpandoObject, showing how you can use this to simplify access to XML documents. In general, this basically makes ExpandoObject a property bag – but the XML sample could have easily been written using a dictionary, if with a bit more verbose of a syntax. However, there are some use cases for ExpandoObject that go above and beyond what can easily be done with a dictionary.

First off, ExpandoObject implements INotifyPropertyChanged. URL Routing in ASP.NET 4. By Scott Mitchell Introduction In the .NET Framework 3.5 SP1, Microsoft introduced ASP.NET Routing, which decouples the URL of a resource from the physical file on the web server.

URL Routing in ASP.NET 4

Using ASP.NET Routing Without ASP.NET MVC. By Scott Mitchell Introduction ASP.NET MVC is a Microsoft-supported framework for creating ASP.NET applications using a Model-View-Controller pattern.

Using ASP.NET Routing Without ASP.NET MVC

Chapter 9. Delegates, Events, and Lambda Expressions. Problem You have multiple objects that need to observe modifications to objects that implement IDictionary<K,V>.

Chapter 9. Delegates, Events, and Lambda Expressions

When an item is added or modified in the dictionary-based collection, each of these observer objects should be able to vote to allow or disallow the action. In order for an action to be allowed to complete, all observer objects must state if they are vetoing the action. If even one observer object votes to disallow the action, the action is prevented. Solution. Lambda Expressions (C# Programming Guide) A lambda expression is an anonymous function that you can use to create delegates or expression tree types.

Lambda Expressions (C# Programming Guide)

By using lambda expressions, you can write local functions that can be passed as arguments or returned as the value of function calls. Lambda expressions are particularly helpful for writing LINQ query expressions. To create a lambda expression, you specify input parameters (if any) on the left side of the lambda operator =>, and you put the expression or statement block on the other side. Enumerable Methods (System.Linq) LINQ TO XML. Getting Started Walking Through a Silverlight Application Take a tour of the XAML and Javascript generated by an application template that's installed with the Silverlight SDK. Organizing XAML Assets Learn how to organize XAML assets in Expression Design and Expression Blend to maximize developer efficiency.

What is that IGrouping result returned from group by LINQ queries? I dont know how much you people use LINQ but for me it was like a blessing.

What is that IGrouping result returned from group by LINQ queries?

Since I figured out how helpful it is I never really looked back. But this post is not about obvious usefulness of LINQ, everyone should know that by now!!! I would like to clarify some exotic details on the results we get from group by queries with LINQ and explain a little bit more on that infamous IGrouping collection. Dynamic in C# 4.0: Introducing the ExpandoObject - C# Frequently Asked Questions.

Blogs

Fabulous Adventures In Coding.