Posts

LINQ Query Syntax Tutorial

Probably the most exciting new feature of LINQ is the ability to write in line SQL style queries, known as query expressions (using query syntax).  This tutorial introduces the basic concepts, and comes complete with source code and demo applications. What is LINQ Query Syntax? LINQ query syntax is a set of query keywords built into the .NET framework (3.5 and higher) that allow the developer to write SQL style commands in line straight in the code editor, without the use of quotes. Introduction The .NET framework 3.5 introduces us to the following query keywords; from / in - Specifies the data source where - Conditional boolean expression (e.g. i == 0) orderby (ascending/descending) - Sorts the results into ascending or descending order select - Adds the result to the return type group / by - Groups the results based on a given key There are more keywords that provide additional functionality, but they are outside the scope of this tut...

Performance Tips of WPF

WPF (Windows Presentation Foundation) provides a very easy way to develop rich user experiences. A drop shadow for example can added by inserting two simple lines of XML. But this simplicity can also mislead us to overuse them. This leads to performance issues. The following tips may help you to fix or avoid them. 1. Reduce the number of visuals by removing unneeded elements, combining layout panels and simplifying templates. This keeps the memory footprint small and improves the rendering performance. 2. Lower the framerate of animations by setting Storyboard.DesiredFrameRate to lower the CPU load. The default is 60 frames/second 3. Load resources when needed. Even thow it's the most comfortable way to merge all resources on application level it can also cost performance by loading all resources at startup. A better approach is to load only often used resources and load the other on view level. 4. Enable Container Recycling. Virtualization brings a lot of perfor...

DATEADD (Transact-SQL)

Image
Returns a specified  date  with the specified  number  interval (signed integer) added to a specified  datepart  of that  date . For an overview of all Transact-SQL date and time data types and functions, see  Date and Time Functions (Transact-SQL) . For information and examples that are common to date and time data types and functions, see  Using Date and Time Data . Transact-SQL Syntax Conventions Syntax Copy DATEADD (datepart , number , date ) Arguments datepart Is the part of  date  to which an  integer number  is added. The following table lists all valid  datepart  arguments. User-defined variable equivalents are not valid. datepart Abbreviations year yy   ,  yyyy quarter qq   ,  q month mm   ,  m dayofyear dy   ,  y day dd   ,  d week wk   ,  ww weekday dw   ,  w hour hh minute mi   ,  n second ss   ,  ...