There are some scenarios that require building a connection string at runtime. For example, if you are building a database utility or if your application allows working with multiple databases. In these cases, you may want to ask the user for the basic parts of the connection and not require entry of a syntactically correct […]
Visual Studio Window | New Window
With the new multi-monitor support, an underused Visual Studio menu option just became much more useful. You can use the Window | New Window option to view a second code window with the same code file. The result looks like this: You can then drag one of the code windows so they are side by […]
Bay.NET Event: .NET 4.0 and VS 2010
We are lucky to have two of Redmond’s finest down here in Silicon Valley for a full day .NET 4.0 and VS 2010 event on May 15, 2010. Click here for more information or to register. I am happy to be providing one of the talks at the event. I am giving the "What’s New […]
LINQ: Mean, Median, and Mode
If you are doing any type of statistical analysis, you probably need to calculate mean, median and mode. There are lots of places on the Web you can find the calculations. This post is different than most in that it uses LINQ and Lambda expressions. Mean is the statistical average of a set of numbers. […]
Multi-dimensional Arrays and IEnumerable
Most of the cool extension methods that you can use with Lambda expressions, such as Where, FirstOrDefault, and Zip, are extensions of the generic IEnumerable<T> class. Interestingly, the .NET multi-dimensional array does not implement the generic IEnumerable<T> class. So you don’t have direct access to any of the Linq extension methods. The reason for this […]
Lambda Expressions: Zip
One of the new features in C# 4 and VB 10 (.NET 4.0) is the Zip extension method on IEnumerable. This method allows you to merge two lists such as two arrays or two generic List<T>. The Zip extension method merges the two sequences by matching up each item in one sequence with another item […]
Grouping and Summing with Lambda Expressions
There are often cases where you need to group on multiple properties and potentially sum on others. This post details how to group and sum on multiple properties using lambda expressions. This example uses an Invoice class, since that provides many opportunities for summing. First, here is a basic Invoice class. In C#: class Invoice […]
VS 2010 Database Project: Adding Stored Procedures
The new Visual Studio 2010 Database Project, as described in this prior post, makes it easy to work with scripts for an existing database or build new scripts directly within Visual Studio. This post details how to add stored procedure scripts to a Database project Start by adding a VS 2010 Database project to your […]
VS 2010 Database Project: Building and Deployment
The new Visual Studio 2010 Database Project, as described in this prior post, makes it easy to manage the scripts for your database from within Visual Studio. This includes building the schema scripts from the individual database object scripts and deploying the scripts back to the database. One of the ways that the new VS […]
VS 2010 Database Project: Adding Tables
The new Visual Studio 2010 Database Project, as described in this prior post, makes it easy to work with scripts for an existing database or build new scripts directly within Visual Studio. This post details how to add table scripts to a Database project Start by adding a VS 2010 Database project to your solution […]