Unlock a file in TFS someone else has locked

31. July 2015 16:27

 

Open a Visual Studio cmmand prompt (Start –> Microsoft Visual Studio nnnn –> Visual Studio Tools)

Navigate to a directory mapped in TFS (i.e. C:\Users\username\Documents\BWPrd\Scripts>)

The command to run is:

tf undo <path to file>/workspace:<workspace name>;<user name>

You can get a list of workspaces with this command:

tf workspaces /owner: <username> /computer:*

SqlDataReader Contains Column Extension Method

30. July 2015 16:59

It seems I have to look this up a lot.  Maybe if I write it down I’ll remember! This is a slick extension method to determine if a SqlDataReader contains a column. The code is originally from this SO post.

public static class DataRecordExtensions
{
    public static bool HasColumn(this System.Data.IDataRecord dr, string columnName)
    {
        for (int i = 0; i < dr.FieldCount; i++)
        {
            if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase))
                return true;
        }
        return false;
    }

About the author

I'm a .NET developer, a husband and a father of three beautiful girls.

Month List