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 [...]
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:
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:
As developers, we frequently end up with duplicate entries in our path. From the command line you can clean up your path using pathman.exe. Here’s a PowerShell Script to find the duplicates and remove them using Pathman.exe:
Asynchronous Programming with C# 5.0 – Mark Michaelis
In C# 5.0 there is really only one significant syntax addition – support for asynchronous programming that is embedded into the language. In this session we go over the is and is-nots of what C# 5.0 enables in the way of parallel processing – both for the UI and for the server tier. Don’t miss this session to learn not only the fundamental syntax but also the best practices and scenarios of what the async keyword enables.
Administration designed for one a single-role centric view to a multi-server view of the environment. The result is that rather than administer a role on a particular server you will now be able to administer a role that may span multiple servers.
The PowerShell based Command-line Interface (CLI) for Windows administration is a both/and experience – both CLI and GUI.
CLI automation increases reliability, auditability, and predictability – across multiple servers none-the-less.
The new unit testing explorer support has a new unit test explorer has a Run dropdown for selecting which text to execute (see Figure 1).
In addition, Visual Studio 11 supports continuous testing – automatically running your tests every time you compile your code. However, as shown in Figure 1, the option to enable continuous testing doesn’t appear from the Run dropdown (and probably shouldn’t because you are not likely to be changing the option back and forth that often). To enable continuous testing, select the Unit Test->Unit Test Settings->Run Tests After Build menu as shown in Figure 2.
I would not hesitate to use Mark and his team again. He and his team have an excellent grasp of current technology and software development methodologies as well as insight into how to appropriately apply them.
Brahma Holding, La Jolla, CA
3024 S. Bannen Ct.
Spokane Valley, WA 99037