Have you ever wondered what is the C# language version used in your C# .NET project. You might have not worried about it because the version of the C# version used depends on the .NET framework version you have used for the project. In this blog post let's see how to view and change the C# version for the project.
- Home
- Tutorials
- OOPS Concepts
- SOLID Principles
- C# class
- C# .NET methods
- Delegates in c#
- Events in C#
- Diff. events & delegates
- Type safety in C# .net
- Diff. ref & out keyword
- Optional Parameters
- Extension methods in C#
- Nullable types in C#
- var keyword in c#
- Inversion of control
- Dependency injection
- composition over inheritance
- how to crack software developer interview in style
- A practical example for c# extension methods
- How inmemory cache was getting inadvertently affected
- Cross check on FirstOrDefault extension method
- A cue to design your interfaces
- Why you shoudn't ignore code compile warnings
- A best practice to write your unit tests
- Software Architecture
- Downloading a file
- PRG Pattern
- ActinName attribute
- Model binding & UI culture
- Working with local data in jqgrid
- Supress default DELETE behavior in JQGRID
- Unique URL and cache
- what are http cookies
- viewing cookies being exchanged & stored in browser
- Persistent and non persistent cookies
- what is cookie less domain
- Login not successfull when cookies are disabled
05 November 2017
viewing c# language ver used in a project
25 October 2017
with net-framework-4-6-2 now you can see variabe caused the NullRefereneException
Today I was going though below .NET Blog post to know more detail on the framework 4.6.2 features.
Out of many, I found a very useful feature. Now when we encounter NullRefereneException, it’s going to say which variable caused it. This will save a ton of time for sure while fixing object reference not set to an instance of an object.
https://blogs.msdn.microsoft.com/dotnet/2016/08/02/announcing-net-framework-4-6-2/18 June 2017
track active item in Visual Studio Solution explorer
If you are working on a BIG solution in Visual Studio, then click the file tab doesn't highlight the file in Solution Explorer by default. This causes you manually going through & searching the solution explorer tree view to find the find file. This task can be daunting every time when you want to do this, especially when you are new to .NET solution and the solution is BIG with more projects added into it.
This problem can be easily solved by enabling "Track Active Item In Solution Explorer" option. Post enabling Track Active Item In Solution Explorer and switch to any file tab in visual studio, the file will be automatically highlighted in the Solution Explorer. So it will become easy to find where in the Solution Explorer the file is located.
How to enable this hidden gem "Track Active Item In Solution Explorer"
- Click "Tools" menu in Visual Studio and then select "Projects and Solutions" in tree view located in left hand side.
- Locate check box "Track Active Item In Solution Explorer", select the option and click OK button to save the changes.
Visual Studio Tool Window showing Track Active Item In Solution Explorer option
14 June 2017
GUID generator in Visual Studio
While writing scripts at times you need to use GUID value as a constant value, etc. There are many options to generate GUID. You could write your own batch script to generate the GUID or you could use other program to generate a GUID.
However if you are using Visual Studio IDE, there is readily an option available to generate the GUID.
Steps to generate GUID in visual Studio
On the tool menu, select CREATE GUID menu item. It opens up CREATE GUID window
- In the CREATE GUID window, click on the copy button to copy the generate GUID to clipboard
- If you want to generate one more GUID, click on the New GUID button
Sample GUID generation output
IMPLEMENT_OLECREATE(<<class>>, <<external_name>>,
0x7154e924, 0xa0ad, 0x4042, 0xa6, 0x38, 0xae, 0x2, 0x29, 0x11, 0xbe, 0xf2);
GUID window
19 July 2015
running an application as ADMIN always
Often you are required to run an application as an Administrator, otherwise, the application might not start at all or it might not work to its full extent. On windows platform, few such examples include but not limited to Visual Studio, Internet Information Services (IIS), etc. To debug an application you need to start visual studio as an ADMIN and for IIS, you need to be an ADMIN even to open it.
Sometimes it so happens that, you start Visual Studio (VS) and when you try to debug you get a warning saying, you cannot debug, because Visual Studio (VS) is not running as an ADMIN. Then you need to exit VS and start again as an Admin. So wouldn't be great if you able to start such app always as an ADMIN by default?.
Below are the steps to run an application as an ADMIN always (on Windows 7 OS). You need to be an Admin on the System to do this changes!
- Locate the application EXE. Right Click on the EXE and open the Application Properties window.
- Select Compatibility tab and Click on the button, "Change Settings for all Users".
- It opens up another window with options to manage "Compatibility for all users". Under Privilege section, check the option "Run this program as an Administrator" option and save the changes.
After these changes, next time when you start an application, it will start by default an administrator, which definitely will save some time for you!
14 May 2015
breakpoint condition in visual studio
Recently I was debugging a multithreaded application to root cause an unhandled exception in one of the for-each iteration on a thread. The for-each statement was being executed thousands of times, so it was too much to time to wait for the failing iteration to occur.
To save my time a cool feature in the visual studio called Breakpoint condition came to rescue to exactly specify a condition on when the breakpoint needs to be hit. If the specified condition evaluates to true the breakpoint will be hit and allows you have debug further.
ProcessControl(control);
}
Steps to add a condition breakpoint
- In the above for each code, add a break point on the line which is invoking ProcessControl() method. And right click on the breakpoint to open the below menu.
- Click on the “Condition…” menu item. It will open the Break point condition windows. Enter your condition there. For the condition you can use any varibale which you can access in the line of code where you have put the breakpoint.
- When the breakpoint condition is met the breakpoint will be hit. Later you can debug as usual.







