Linq Concatenate String

In order to concatenate a List<T> of string, or infact any object, you can either write a loop to enumerate through the collection and construct a string or you can make use of the Aggregate function exposed by the IEnumerable<T> extensions, exposed when you have a using System.Linq;

List<string> keywords1 = new List<string> { "C#", "Linq", "Generics", "Collections", ".NET", "Microsoft" };

// Concatenate a simple list of strings

string keywordsResult1 = keywords1.Aggregate((keyword1, keyword2) => keyword1 + "," + keyword2);

SQL Merge

The merge keyword was introduced into Microsoft SQL Server in the 2008 version.

It allows you to synchronize a table by performing update, insert and delete operations based upon the differences exposed via the match criteria you specify in the query.

merge into @TargetTable target

using (select Id, Name from @SourceTable) source

on target.Id = source.Id

when matched then

update set

Name = source.Name


Delete Inner Join

Sql Server supports deleting rows from tables using joins to target specific rows.

delete SourceTable

from SourceTable

inner join JoinedTable on JoinedTable.SourceTableId = SourceTable.Id

You can also specify further filters using a where clause.

Canonical Url Redirect

It is quite common to register multiple domain names which point to the same website for a number of reasons. A good example of this is brand protection or even rebranding. Unfortunately this can affect your websites search engine ranking because multiple sites with duplicate data rank poorly.

IIS and ASP.NET makes this task very simple by employing the use of the UrlRewrite module.