Posts

Exception Handling corrective approach

Hi, below is just simple example as per my professional experience for exception handling   public class NestedExceptionHandling   {       public void MainMethod()       {           try           {               //some implementation               ChildMethod1();           }           catch (Exception exception)           {               //Handle exception           }       }         private void ChildMethod1()       {           try           {               //some implementation               ChildMethod2();           }           catch (Exception exception)           {               //Handle exception        throw;             }       }         private void ChildMethod2()       {           try           {               //some implementation           }           catch (Exception exception)           {               //Handle exception               throw;           }       }   } So what would happen with the above code if the same exception were handled multiple times an

Async await concept as per my experience

Hi, I am a .Net developer, worked on several desktop wpf application. In c# 5.0 MS provide Async await feature that simply help us with freedom UI to stuff when some big method being executed.  Suppose I have big method with long operation like DB insertion along with other stuff. I click on some button to trigger that method. at that time WPF freeze the UI because WPF working on other important operation to execute that method. and its unable to update your UI because its doing other stuff. so here Async await comes in picture. So in my code I will make my Big Method Async which will return some value with Task type. Like  Private async void mainMethod() { //here you can run methods which dont need anything from below method. //for e.g. update some text on button yourButtonName.Dispatcher.Invoke(()=> yourButtonName.content("processing..");); await  Task.Run(()=> SaveToDb());  bla; bla; bool IsInserted = await