Saturday, January 5, 2013

Search and filters available in visual studio 2012

I have already written lots of post about Visual Studio 2012 features and this post is also going to be part of that series. You can get whole series of post from the following link.

Visual Studio 2012 features

In this post we are going to talk about search and filters provided into the visual studio 2012. There are lots of emphasis there in search and filters in visual studio 2012.You can almost search every thing including errors also. There are different search options are available for that.

Quick launch search in visual studio:


Prior to previous edition in visual studio 2012 there was quick launch search given at the top of the visual studio. From here you can search for anything in solutions and even menu’s also. It will provide you a quick launch for that.
Share:
Friday, January 4, 2013

Lazy<T> in C# 4.0

Before C# 4.0 there was no on demand initialization by default. So at the time of declaration we need to create a value or object will be null or we have to create on demand initialization via coding.. But with C# 4.0 we now have lazy class. As per MSDN it support lazy initialization so it means if we use lazy class then it will initialize the object at the time of demand.

It is very useful for UI responsiveness and other scenario's.  Lazy initialization delays certain initialization and  it’s improve the start-up time of a application. In the earlier framework if we need this kind of functionality we have to do it manually via coding but from C# 4.0 onwards it have Lazy<T> class. With the Help of this we can improve the responsiveness of C# application. Following is a simple example.
Share:
Sunday, December 30, 2012

Lock keyword in C#

As we have written earlier we have now multi-core CPU for our computers and laptops and to utilize that we need to use threading in code. Now if we create thread and access same resource at same time then it will create a problem at that time locking become quite essential in any programming language.

Let’s consider a scenario. We are having a small firm of computers and each computer is shared by two employees and they need to use computer for putting their sales data in excel sheet. So they can not work together at same time and one has to work and other has to wait till first one complete the work. Same situation can be occurred in programming in where we are using same resource for multiple thread.

C# provides locking mechanism via lock keyword. It restricts code from being executed by more then one thread at a time. That is the most reliable way of doing multi threading programming.
Share:
Thursday, December 27, 2012

Merry Christmas to all my readers

This is not a usual technical post I am writing here. I just wanted to take a moment and wishing you Merry Christmas and happy holidays. All readers are has been great support to this blog and on this occasion I want thank you guys for all the support and love you have shown during this year 2012. I have achieved so much through this blog and its been not possible without your support.

I wish that year 2013 will bring you all joy and happiness you required. May all your wishes fulfil.

MerryChristmas

Stay tuned for more. I have lots of stuff for you in 2013. Till then happy holidays!! and once Merry Christmas to you and your family.
Share:
Friday, December 21, 2012

Where I can find SQL generated by Linq-To-SQL

Yesterday I have written a blog post about Where I can find SQL Generated by Entity Framework? and same day I got request from one of the our reader Ramesh that how I can find SQL generated by Linq-To-SQL?. I thought its a good idea to write a blog post to share amongst all who need this instead of reply in comments.  In this post I am going to explain how we can get SQL generated by Linq-To-SQL.

For this post I am going to use same table like following. A customer table with two columns CustomerId and CustomerName.

How to get SQL staement generated by Linq-To-SQL
Share:
Thursday, December 20, 2012

Where I can find SQL Generated by Entity framework?

Few days back I was optimizing the performance with Entity framework and Linq queries and I was using LinqPad and looking SQL generated by the Linq or entity framework queries. After some point of time I got the same question in mind that how I can find the SQL Statement generated by Entity framework?

After some struggling I have managed to found the way of finding SQL Statement so I thought it would be a great idea to write a post about  same and share my knowledge about that. So in this post I will explain how to find SQL statements generated Entity framework queries.

To demonstrate the idea Let’s a very simple console application with C# and then  create a table called ‘Customer’ with CustomerId and CustomerName field in sql server.
Share:
Tuesday, December 18, 2012

Caller Info Attributes in C# 5.0

In c# 5.0 Microsoft has introduced a Caller information attribute. It’s a new feature that is introduced in C# 5.0 and very useful if you want to log your code activities. With the help of this you can implement the log functionality very easily. It can help any programmer in tracing, debugging and diagnostic of any application.
With the help of Caller Information we can get following information over there.

  1. CallerFilePathAttribute: With help of  this attribute we can get full path of source file that contains caller. This will be file path from which contains caller at compile time.
  2. CallerLineNumberAttribute:  With the help of this attribute we can get line number of source file which the method is called.
  3. CallerMemberNameAttribute: With the help of this attribute we can get the method or property name of the caller.

Let’s write a simple example for that to see how its works. Following is a code for that.
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews