Sunday, January 23, 2011

C# - Static Constructors

• You declare a static constructor by "static" keyword in front of the constructor name.
• To initialize static fields in a class you can use static constructor.
• A static constructor is called before an instance of a class is created
• A static constructor is called before a static member is called.
• A static constructor is called before the static constructor of a derived class.
• A static constructor does not take access modifiers or have parameters.
• A static constructor cannot be called directly.
• They are called only once.
• Can't access anything but static members.

class MyClass
{
// Static constructor
static MyClass()
{
//...
}
}

Share/Bookmark

Sunday, January 9, 2011

Visual Studio 2010 runs faster when the Windows Automation API 3.0 is installed

Applications that use Windows Automation APIs can significantly decrease Microsoft Visual Studio IntelliSense performance if Windows Automation API 3.0 is not installed. For example, the Windows pen and touch services can significantly decrease Visual Studio IntelliSense performance if Windows Automation API 3.0 is not installed.
http://support.microsoft.com/kb/981741
Share/Bookmark

Sunday, January 2, 2011

http://twitter.com/fbayanati


Tweets
Share/Bookmark

T-SQL Copy database diagrams to another database

Unlike stored procedure, functions, tables, views, ... MS Sql server doesn't have an easy way to script or create database diagrams. It keeps all the diagrams in [sysdiagrams] system table.

SELECT *
FROM sysdiagrams

USE newDb
GO

INSERT INTO sysdiagrams
([name], pricipal_id, version, definition)
SELECT [name], pricipal_id, version, definition
FROM #tempDiagrams

Share/Bookmark