Showing posts from July, 2011

Notify Async operation in C#

Threading is a nice thing until we know how it is being executed. Sometime it can be a pain in the arse and sometimes asset you gain from. Today came across a question on how to get to know a async operation is completed thought of spending some time to explain it in my way. How do you get to know a Async operation is completed, well one way is  IAsyncResult ,this is how we go, Lets create a delegate that will be used call our time consuming or background task. delegate   string   CallFunctionDelegate ( string  arg1,  string  arg2); say the time consuming function private   string  DoSomeThingBig( string  arg1,  string  arg2) just to show how to pass argument, i have used some dummy arguments. Once the time consuming function is completed lets call the notification function that will called after the asynchronous operation let that be private   void  AfterDoingSomethingBig( IAsyncResult  result) Now for this kind of function signature we have a delegate class calle

Visual studio styles

Transform your visual studio's visual looks :) There are a lot of templates that are readily available. Thanks to Luke Sampson who has created a space to share styles. Personally i like  WekeRoad Ink   and  Zenburn 2010 public   partial   class   _Default  : System.Web.UI. Page     {          delegate   string   CallFunctionDelegate ( string  arg1,  string  arg2);          protected   void  Page_Load( object  sender,  EventArgs  e)         {              AsyncCallback  CallBackAfterAsynOperation =  new   AsyncCallback ();         } Its damn easy to get it done. 1.Open Visual Studio 2.Click on Tools->Import and export settings 3.Select Import selected environment settings 4.Select No, Just Import new setting 5.Now browse for the settings file you downloaded from Make your visual studio interesting. If you are really good in colors create one style and upload in Luke's repository.