Posted on October 5, 2009 by kalpeshshirodker
There comes a time when you need to get the absolute path to reference a file or some resource existing at some relative path of the website or web application. As things turned i was in need some of the similar functionality. The first thing that came to my mind was doing something similar :
//get [...]
Filed under: C#, Dot Net, How To, Technical | Leave a Comment »
Posted on September 23, 2009 by kalpeshshirodker
When weneed to persist a dataset object, usually what we do is use the WriteXml() method for the Dataset object. For most cases the default implementation works fine.
So
DataSet dsObj = GetDatasetObject();
dsObj.WriteXml(filename);
If while saving the dataset, a particular contained NULL values, that column information will not be outputted. So when you try to [...]
Filed under: C#, Dot Net, How To, SQL Server, Technical | Leave a Comment »
Posted on September 19, 2009 by kalpeshshirodker
Recently i came across a wierd problem while developing a web user control. I needed to persist some data across page postbackās. I took the ViewState approach, which had been used previously to do the same task.
I had thought that it would be easy as it had been done a multiple times earlier, but [...]
Filed under: C#, Dot Net, How To, Technical, Uncategorized | Leave a Comment »
Posted on September 12, 2009 by kalpeshshirodker
For quite some time now i have been intending to write about Enum with Flags attribute set. Enum with Flags attribute set allows the enum to be used as Bit flags where each bit signifies whether a particular option is set or not. When using this very powerful feature there is always a need to [...]
Filed under: C#, Dot Net, How To, Technical | Leave a Comment »
Posted on March 28, 2009 by kalpeshshirodker
Anyone who has used C# must be familiar with the most useful and the most underrated statement in th C# vocabulary, the "USING" statement. It is so common that you almost forget that it exists in there and its most common usage is to simplify the usage of objects in namespace i.e. Seperation of object [...]
Filed under: C#, Technical | 4 Comments »
Posted on February 23, 2009 by kalpeshshirodker
As i was reading the great book “CLR via C#” by Jeffery Richter, i stumbled upon one of these very subtle nuances and useful technique introduced in C#, it is called the NULL Coalescing Operator denoted by “??” (refer C# Reference (MSDN))
As per the definition the “Null Coalescing ” returns the value denoted by the [...]
Filed under: C#, Technical | 1 Comment »
Posted on January 31, 2008 by kalpeshshirodker
Sometime back while coding for a project, i was faced with a unique problem. While let me explain what i was trying to do.
As all of you know, .NET provides us to define our own events which are executed on some condition. You can provide a function which will be executed when the event occurs, [...]
Filed under: C#, How To, Technical | Leave a Comment »
Posted on January 30, 2008 by kalpeshshirodker
When using p/invoke to call unmanagged code, you may get some error codes based on the operations you have performed. Most of the time the error codes(system error codes) would be integer and going through the corresponding API documentation doesnt leave you anywhere. So what do you do when faced with this dilemma? Search the [...]
Filed under: C#, Technical, Window API | Leave a Comment »
Posted on October 24, 2007 by kalpeshshirodker
Suppose you have implemented a multi-threaded windows application, where there are dedicated threads to do certain dedicated task. Periodically during the execution of the application you want to know the status of some operation through a UI control on a form. The application which may immediately come to your mind which require this functionality might [...]
Filed under: C#, How To, Technical | 1 Comment »
Posted on September 6, 2007 by kalpeshshirodker
When you design an application it always a good idea to split your code into different modules. Clubbing all the methods, objects which are related to each other together. Inadvertently you may have to define different classes to meet this objective. More often than not you would have separateĀ assemblies or DLL’s which contain this class [...]
Filed under: C#, Dot Net, Technical | 1 Comment »