As discussed in my last article on C# 6.0 features we have discussed some of the interesting features like : Auto property initialization, Expression bodied functions, Static class uses and string interpolation method. In this post, we will take the discussion ahead with more language features introduced with the new language.
The features will be covered with basic introduction to internals are :
5. Null Conditional operators
6. Exception filters
7. nameof operator
8. Dictionary initializers
9. await in try / finally.
10. Parameterless constructor for struct
Handy Tricks and Tips to do your .NET code Fast, Efficient and Simple. Some common questions that comes into mind. Please check if you could find them listed or not.
Showing posts with label async. Show all posts
Showing posts with label async. Show all posts
Wednesday, March 11, 2015
Sunday, April 21, 2013
.NET Book : Visual Studio 2012 and .NET 4.5 Expert Development Cookbook (Must Read)
Friends,
It is my great honor to tell you that my book has finally been released this week. If you have ever liked any of my blogs or internals, you would like this book for sure. There are lot of things to learn from the book and I can assure you that you wont be upset with this book if you buy it.
The "Visual Studio 2012 and .NET 4.5 Expert Development Cookbook" is a book that guides you through steps to ensure you enrich the best experience with the latest technology in the best amount of time possible. The book focusses to give you under the hood expertise in .NET technologies it tends to cover and adapts you the best to face common problems of these technologies. The book is divided in forms of recipes. Each of these recipes gives you clear insight of the problem and step by step process to solve the issue practically. It also addresses the advanced features associated with each of those recipes that gives you additional advantage on getting precise knowledge about the problem and its associated issues.
It is my great honor to tell you that my book has finally been released this week. If you have ever liked any of my blogs or internals, you would like this book for sure. There are lot of things to learn from the book and I can assure you that you wont be upset with this book if you buy it.
The "Visual Studio 2012 and .NET 4.5 Expert Development Cookbook" is a book that guides you through steps to ensure you enrich the best experience with the latest technology in the best amount of time possible. The book focusses to give you under the hood expertise in .NET technologies it tends to cover and adapts you the best to face common problems of these technologies. The book is divided in forms of recipes. Each of these recipes gives you clear insight of the problem and step by step process to solve the issue practically. It also addresses the advanced features associated with each of those recipes that gives you additional advantage on getting precise knowledge about the problem and its associated issues.
What you will learn from this book
- Basic usage of Visual Studio 2012 IDE and its various components and better utilization of the tool while writing code
- Understand memory management techniques to build better applications
- Understand the .NET infrastructure with in-depth analysis of its internals
- Architect solutions that leverage the full power of .NET language gems, understanding when to use what
- Implement multithreaded / asynchronous applications using recent updates on .NET 4.5 and compare the past approaches
- Create secure ASP.NET web based applications in .NET 4.5 with use of JQuery and HTML5 for rapid application development
- Architect advanced .NET client applications using MVVM with WPF 4.5
- Understand touch sensitive devices and leverage skills to develop multi-touch applications inside Windows 8
Labels:
.NET infrastructure,
.NET Memory Management,
asp.net4.5,
async,
book,
C#,
CodeProject,
cookbook,
html5,
internals,
jquery,
multithreading,
MVVM,
push technology,
TPL,
TPL Data Flows,
VS2012,
Windows8,
WPF
Saturday, June 4, 2011
Playing with Reflection and Async
Hi Guys,
In this code I have just put a delay of 10 seconds. Now after the execution is finished, another message will be printed on the screen.
Task Asynchronous Pattern as you already know from my article, is one of the major change of next generation .NET applications. As this is already discussed in detail in the article, I will not repeat the same again here in this post. If you don't know what is it, please go ahead and read the article. In this post, I will try to use reflection to invoke our own async method.
So to start, let us take a look at one of the simplest Async method.
static void Main(string[] args) { Program p = new Program(); Task t = p.TryCallAsync(10000); t.Wait(); Console.ReadLine(); } public async Task TryCallAsync(int delay) { Console.WriteLine("TaskEx.Delay is called : will wait for {0} milliseconds", delay); await TaskEx.Delay(delay); Console.WriteLine("Finished execution Return to the caller"); }
In this code I have just put a delay of 10 seconds. Now after the execution is finished, another message will be printed on the screen.
Labels:
async,
C#,
C#5.0,
CodeProject,
DLR,
internals,
Reflection
Monday, May 2, 2011
Creating Animated Splash screen in Windows Phone 7
Creating a beautiful splash screen is always great to see for any application. Windows Phone 7 being no exception to it, you want to give the user great look and feel while loading the application using your Splash Screens. In this article, I am going to spend some time by talking about some of the probable options that you have to create your own Splash Screen for your windows phone 7 application.
What is Splash Screen?
Splash screen is the first screen that comes as an introduction to the application before the application gets on executing. During the application loads up into memory there are lot of things happen in background. The process is created in memory, memory blocks are allocated, Virtualized File System gets initialized etc. During these phase of loading the application, the application hung up and the user sees the black screen. If this wait becomes too long, the user gets frustrated and might stop using the application as well. The Mobile Marketplace also puts a threshold of 10 seconds in which your application must load, otherwise your application will be rejected from App Store. During this phase, if you show some nice little splash screen to the user without hampering the normal loading of the application, the user will feel much more comfortable with your application.
In this post I will demonstrate how you can create / use splash screen for your windows Phone 7 application and the different approaches available to you for this.
Basically there are two options available before you which will allow you to show your customized splash screen :
What is Splash Screen?
Splash screen is the first screen that comes as an introduction to the application before the application gets on executing. During the application loads up into memory there are lot of things happen in background. The process is created in memory, memory blocks are allocated, Virtualized File System gets initialized etc. During these phase of loading the application, the application hung up and the user sees the black screen. If this wait becomes too long, the user gets frustrated and might stop using the application as well. The Mobile Marketplace also puts a threshold of 10 seconds in which your application must load, otherwise your application will be rejected from App Store. During this phase, if you show some nice little splash screen to the user without hampering the normal loading of the application, the user will feel much more comfortable with your application.
In this post I will demonstrate how you can create / use splash screen for your windows Phone 7 application and the different approaches available to you for this.
Basically there are two options available before you which will allow you to show your customized splash screen :
Labels:
.NET,
async,
beyondrelational,
C#5.0,
CodeProject,
MVVM,
silverlight,
Windows Phone7,
XAML
Thursday, April 28, 2011
Async support for Silverlight and WP7
Async support in C# language brings the new life to the modern application development to bring forth the same technique of writing your code and bring asynchrony easily. The main focus of async ctp is to ornament the language in such a way so that the developer could seamlessly create applications that brings asynchrony yet not dealing with its complexity. Hence using the new technique, asynchrony could easily achieved in a program without refactoring the whole program with lots of callbacks and method calls. I have already talked about it in a separate article. If you don’t know, please visit “Async CTP 5.0”.
Async CTP is released again recently and announced in MIX 11. Just after it is released, the first thing that everyone looks for is what is new in the release. As a matter of fact, I did jumped back to see them but eventually found out that there is nothing new in this build in terms of new features is concerned but the release focuses on fixes of performance adding debugging capabilities etc. I will definitely look back to them later in another post, but in this post I am going to talk about another important thing that featured with this release. As opposed to the previous release, the current release now supports Silverlight and Windows Phone 7 environments. This seems to be interesting.
What is Asynchrony?
The word asynchrony means something that is running without blocking other operations running in parallel. If you have created a background Thread to process some data, you are actually doing asynchronous job in background as your foreground operation does not get hampered. In vNext C# introduces Asynchrony using TPL. The two new keywords “async” and “await” could be used to make one sequential method asynchronous. Hence the new way of developing asynchronous program replaces the traditional approach where we needed to refactor the code totally to gain asynchrony in our application. Basically, this is done using the StateMachine to store the entire method into a form of states, and each states are delegated into batch of statements. The Task.ContinueWith is used in the system to ensure that the method body gets executed sequentially. Yes, it’s a compiler trick. If you want to know more about it, please read through my entire article on “Async CTP”.
Async CTP is released again recently and announced in MIX 11. Just after it is released, the first thing that everyone looks for is what is new in the release. As a matter of fact, I did jumped back to see them but eventually found out that there is nothing new in this build in terms of new features is concerned but the release focuses on fixes of performance adding debugging capabilities etc. I will definitely look back to them later in another post, but in this post I am going to talk about another important thing that featured with this release. As opposed to the previous release, the current release now supports Silverlight and Windows Phone 7 environments. This seems to be interesting.
What is Asynchrony?
The word asynchrony means something that is running without blocking other operations running in parallel. If you have created a background Thread to process some data, you are actually doing asynchronous job in background as your foreground operation does not get hampered. In vNext C# introduces Asynchrony using TPL. The two new keywords “async” and “await” could be used to make one sequential method asynchronous. Hence the new way of developing asynchronous program replaces the traditional approach where we needed to refactor the code totally to gain asynchrony in our application. Basically, this is done using the StateMachine to store the entire method into a form of states, and each states are delegated into batch of statements. The Task.ContinueWith is used in the system to ensure that the method body gets executed sequentially. Yes, it’s a compiler trick. If you want to know more about it, please read through my entire article on “Async CTP”.
Labels:
.NET,
architecture,
async,
beyondrelational,
C#,
C#5.0,
CodeProject,
debugging,
design pattern,
IsolatedStorage,
silverlight,
Windows Phone7,
XAML
Monday, March 7, 2011
All about .NET Timers - A Comparison
Threads and Timers are the most common things that you need for your application. Any work that needs to be done in background without intervening the work that is running in the foreground needed to be done using a Thread. We create Threads to delegate a long running process in background so that the UI remains unblocked. Timers on the other hand is a special module which runs after a certain interval of time in background. So you would think Timers will also create a new Thread in background and runs the module associated with it after a certain time. This is not always true.
In this post, I will compare most of the timers available with .NET right now, and later on discuss about DispatcherTimer in WPF.
Difference between Concurrency and Asynchrony?
Now if you look back when Microsoft introduced async CTP in PDC 2010, or my own article on Async, it is clearly stated that Asynchrony and Concurrency are two different concepts. Asynchrony means running a job without blocking the Thread where it is working at. Concurrency is actually a special kind of asynchrony where it is achieved by creating a new Thread. Hence you can say, all sorts of concurrency is asynchrony while all asynchrony is not concurrency. You can have asynchrony without concurrency and it is really worth doing that, as you all know it is not good to put every work in Separate thread. ThreadPools could somewhat help by allowing you to manage threads but still Threads are for long running background processes, so beware to use it only when you absolutely require it.
Going ahead with this thought, lets compare the existing Timers.There are a number of Timers available with .NET before. Many of us might not know what is the basic difference between them. Lets put a comparative analysis on them one by one.
In this post, I will compare most of the timers available with .NET right now, and later on discuss about DispatcherTimer in WPF.
Difference between Concurrency and Asynchrony?
Now if you look back when Microsoft introduced async CTP in PDC 2010, or my own article on Async, it is clearly stated that Asynchrony and Concurrency are two different concepts. Asynchrony means running a job without blocking the Thread where it is working at. Concurrency is actually a special kind of asynchrony where it is achieved by creating a new Thread. Hence you can say, all sorts of concurrency is asynchrony while all asynchrony is not concurrency. You can have asynchrony without concurrency and it is really worth doing that, as you all know it is not good to put every work in Separate thread. ThreadPools could somewhat help by allowing you to manage threads but still Threads are for long running background processes, so beware to use it only when you absolutely require it.
Going ahead with this thought, lets compare the existing Timers.There are a number of Timers available with .NET before. Many of us might not know what is the basic difference between them. Lets put a comparative analysis on them one by one.
Monday, November 29, 2010
Summary of Microsoft Community Tech Days - 28th November Kolkata
Yesterday(28th November 2010), we had our Session for Community Tech Days Kolkata, In association with Kolkata .NET community we have put our effort to produce few great Sessions from few great people. In this post, lets cherish those magical moments we had together (or if you missed). Here is the Agenda :
Labels:
ASP.NET 4.0,
async,
C#,
debugging,
Online Session,
WPF
Location:
Elgin, Kolkata, West Bengal, India
Saturday, November 20, 2010
Debugging with Async
C# async feature really exposes a lots of things to us. I can see, there is lots of people is discussing about it in MSDN forums, few people wanted to get rid of the Task from the async methods and really want to deal with normal return types, while others just wanted to get rid of the async postfix. During my leisure, I read them but what I thought the most important part of the feedback is that most of the people really liked the way Microsoft simplifies the Asynchronous approach of programming style.
I have already studied some of the important facts on Async style of programming, and found that it uses the StateMachine to let the program return after a certain portion of the method gets executed while the Rest of the program is sent as ContinueWith for the Task. Thus the TaskCompletion automatically restarts the method and continue. If you want to know more about how Task gets executed in async methods, please read my article where I have discussed how exactly the current trend of programming style got changed.
Today while I was looking at the implementation of Async style of programming, I just discovered an Internal class named DebugInfo inside the System.Runtime.CompilerServices.AsyncMethodBuilder.
You can see the class is internal, and hence not exposed from the perspective of BCL. You cannot create object of the class or even look at the private member LocationForDebuggerDisplay. But the only thing that you can see through this is the ActiveMethods.
I have already studied some of the important facts on Async style of programming, and found that it uses the StateMachine to let the program return after a certain portion of the method gets executed while the Rest of the program is sent as ContinueWith for the Task. Thus the TaskCompletion automatically restarts the method and continue. If you want to know more about how Task gets executed in async methods, please read my article where I have discussed how exactly the current trend of programming style got changed.
Today while I was looking at the implementation of Async style of programming, I just discovered an Internal class named DebugInfo inside the System.Runtime.CompilerServices.AsyncMethodBuilder.
You can see the class is internal, and hence not exposed from the perspective of BCL. You cannot create object of the class or even look at the private member LocationForDebuggerDisplay. But the only thing that you can see through this is the ActiveMethods.
Subscribe to:
Posts (Atom)
Author's new book
Abhishek authored one of the best selling book of .NET. It covers ASP.NET, WPF, Windows 8, Threading, Memory Management, Internals, Visual Studio, HTML5, JQuery and many more...
Grab it now !!!
Grab it now !!!