Subscribe to RSS Feed

When trying to restore one database backup; which I successfully did (I’m using SQL Server 2005), and want to delete the users of the database which are restored along with the DB; I received this error which says “The database principal owns a schema in the database, and cannot be dropped”.

Continue Reading »
No Comments
The selected file is not a valid Visual Studio solution – Solved

To Make a Visual Studio 2010 project open in 2008 there are two steps involved as described below Step1 Changes to the Solution File(.sln) Open the .sln file corresponding to the Project to be converted with Notepad Locate the following line: Microsoft Visual Studio Solution File, Format Version 11.00 Replace 11.00 with 10.00 Locate...

Continue Reading »
No Comments

Extension method is new feature in C# 3.0 used to, well, extending a method. There is no better way to explain it then the code: 1234567string testInvalidPassword = "sonic"; string testValidPassword = "greenland"; string testValidPasswordMatch = "greenland"; Console.WriteLine(testInvalidPassword.IsValidPassword()); Console.WriteLine(testValidPassword.IsValidPassword()); Console.WriteLine(testValidPasswordMatch.IsPasswordMatch(testValidPassword)); Here I have series of string variables and what I am doing here is...

Continue Reading »
No Comments

A list of some shortcus and new features to VS 2010 and C# 4.0: Default values for parameters Can access parameters by name (i.e. SomeFunction(name: “Dan”, age: 26); Can now put Labels on breakpoints and filter the breakpoints, as well as import and export breakpoints. Window => New Window to open up same file...

Continue Reading »
No Comments

Enum Operations

April 26, 2011 by

Sometime we might need to traverse through all enum members for any reason. Say we would like to dynamically add controls to the form on the base of enum… 1234foreach (MyTypeEnum myType in Enum.GetValues(typeof(MyTypeEnum)) {           //myType.ToString()         }

Continue Reading »
No Comments

Basically, the Stack Trace is a trace of function calls that go on the Stack. When a program runs, it copies functions from the Heap to the Stack, in a “Stack” (so to speak) which is a stack of the functions. When a function is called, a copy of it is put on the...

Continue Reading »
No Comments

When working with reflection in csharp we may come across cases when we want to access the return type of a delegate through its Type object. For example consider the case below.. 1234Type type = typeof(Func<foo , Bar, Baz>); // ???? // Use reflection to come to the following expected result Type result =...

Continue Reading »
No Comments

Making a class serializable We have a class. What do we have to do to make it serializable? First: Add the attribute in front of the class’ definition. Take a look at the class below: 12345678910111213[Serializable] public class Store {     public int stockCount {get;set;}     [NonSerialized]     private int...

Continue Reading »
No Comments

Singleton Pattern: There are situations in a project where we want only one instance of the object to be created and shared between the clients. No client can create an instance of the object from outside. There is only one instance of the class which is shared across the clients. Below are the steps...

Continue Reading »
No Comments

Prototype pattern falls in the section of creational pattern. It gives us a way to create new objects from the existing instance of the object. In one sentence we clone the existing object with its data. By cloning any changes to the cloned object does not affect the original object value. There are two...

Continue Reading »
No Comments

Stay in Tune

    Twitter

    Follow Me on Twitter!