There are two new exception-handling features in C# 6.0. The first is an improvement in the async and await syntax and the second is support for exception filtering.
When C# 5.0 introduced the async and await (contextual) keywords, developers gained a relatively easy way to code the Task-based Asynchronous Pattern (TAP) in which the compiler takes on the laborious and complex work of transforming C# code into an underlying series of task continuations. Unfortunately, the team wasn’t able to include support for using await from within catch and finally blocks in that release. As it turned out, the need for such [...]
It’s not uncommon that in the midst of writing a statement, you find you need to declare a variable specifically for that statement. Consider two examples:
In the midst of coding an int.TryParse() statement, you realize you need to have a variable declared for the out argument into which the parse results will be stored.
While writing a for-statement, you discover the need to cache a collection (such as a LINQ query result) to avoid re-executing the query multiple times. In order to achieve this, you interrupt the thought process of writing the for-statement to declare a variable.
Another C# 6.0 “syntactic sugar” feature is the introduction of using static. With this feature, it’s possible to eliminate an explicit reference to the type when invoking a static method. Furthermore, using static lets you introduce only the extension methods on a specific class, rather than all extension methods within a namespace. The code of Listing 1 below provides a “Hello World” example of using static on System.Console.
Listing 1: Static Using Statements
WriteLine("Hello, my name is Inigo Montoya... Who are you?: ");
stringname=ReadLine();// Respoond: No one of consequence
WriteLine("I must know.");
WriteLine("Get used to disappointment");
In this example, the Console qualifier was dropped a total of 9 times. Admittedly, the example is contrived, but even so, the point is clear. Frequently a type prefix on a static member (including [...]
Michael Desmond a popular blogger for MSDN Magazine is giving a shout out to Mark Michaelis for his lead feature in this month’s issue of MSDN:
“Be sure to check out the May issue of MSDN Magazine, which spotlights some of the powerful new capabilities highlighted at the Microsoft Build Conference last month. Our lead feature, by Mark Michaelis, explores the new features and capabilities coming in the next version of the C# programming language (C# vNext, expected to be called C# 6.0 upon release).
As Michaelis points out in his feature, C# 6.0 won’t [...]
To make generic tests robust enough to run for all developers on your team and on the build server, you are likely going to want to avoid hard coding the path to the executable. To do this successfully, you need to have a list of all the environment variables that are available when the test executes. These can be obtained by creating a generic test with the existing program as %COMSPEC% (the fully pathed location for cmd.exe) and setting “/C set” as the Commnd-line arguments. The result, with all standard environment variables pulled out, is as follows:
On Tuesday, Sept. 17 Mark will be presenting to the PMI Inland Northwest Chapter:
Are you in charge of the project without any authority to make stuff happen? Are you tasked with turning a project around but in reality the only thing different from the last project manager is… you (and the additional time in which the project degraded further). Are you responsible for insufferable developer/contractors/IT personnel who see you as little more than an administrator?
Don’t miss this Mark Michaelis style “talk” in which he discusses the all too common problem of being a leader without authority.
IntelliTect is proud to announce two of our team members have been chosen to teach at the Office Microsoft DevCamps. This training series targets developers worldwide on Microsoft based Technologies and Products. Mark Michaelis, a Microsoft Regional Director, Trainer and MVP, and Michael Stokesbary, a SharePoint Development Architect and Trainer were asked to instruct software engineers around the world on building applications using Office and SharePoint 2013. They will be educating developers in nine locations worldwide. Mark will be covering the engagements in: Seattle, Washington, Beijing, China, Delhi, India, Bangalore, India, Sao Paulo, Brazil, and Irvine, California. Michael Stokesbary [...]
For those of us frequently presenting, we are faced with having to switch to presenter fonts by changing the font size for multiple different display items on the Environment->Fonts and Colors Options dialog or (if we are looking for an adequate but not optimal solution) simple changing the zoom level. Of course, when we get back to our desks, we have to switch back the settings to fit with our 3 monitor 2560 × 1600 WQXGA resolution (purely hypothetical in my case).
If you have had a Team Foundation Server (TFS) instance running for any significant length of time you undoubtedly have old shelvesets lying around from other developers (surely you wouldn’t have done this) that have long ago expired and although moldy, they have not disintegrated. Consider cleaning them up using the following short PowerShell script from Kelly Adams: