Posts

Showing posts from April, 2012

Query Optimization Tips

Use  views and stored procedures  instead of heavy-duty queries. Try to use  constraints  instead of triggers, whenever possible. Use  table variables  instead of temporary tables. Try to use  UNION ALL statement  instead of  UNION , whenever possible. Try to  avoid using the DISTINCT  clause, whenever possible. Try to  avoid using SQL Server cursors , whenever possible. Try to  avoid the HAVING clause , whenever possible. If you need to return the total table's row count, you can use alternative way instead of  SELECT COUNT(*) statement. Include  SET  NOCOUNT   ON  statement into your stored procedures  to stop the      message indicating the number of rows affected by a T-SQL statement. Use the select statements with  TOP keyword or the SET ROWCOUNT  statement, if  you need to return only the first n rows.        More Tips with examples Sql Statements are used to retrieve data from the database. We can get same results by writing different sql queries. But

Delegates in C#

Delegates in C# Delegates in C# are similar to functional pointers in C++ and are used to encapsulate a method that have similar signature like delegate. We can declare a delegate type with “delegate” keyword in C#. Moving forward, we will see more about delegates and its uses. Delegates – A Detailed Look A delegate is a type that references a method once it is assigned to that method and it behaves exactly like that method. The delegate method can be used like any other method, with parameters and return value. Any method that matches the delegate’s signature, in terms of return type and parameters can be assigned to that delegate. Some information about Delegates 1.        Delegates have are similar to c++ function pointer but are type safe. 2.        Delegates allow method to be passed as parameters. 3.        Delegates can be used to define callback methods. 4.        Delegate can be chained together for example: multiple methods can be called on a S