Update on C# and VB in VS2017

The latest version on Visual Studio 2017 at this moment is still in Release Candidate (RC) stage on build 26127.03, released on 1st Feb 2017. There are many new features in this VS2017 which it is too long to write all of them down here. You may visit the release notes for more detail.

Here I want to highlight the new support for C# & VB, and also 2 new members in VS2017, Visual Studio for Mac and Visual Studio Mobile Center.

Visual Studio for the Mac

is built from the ground up for the Mac and focused on full-stack, client-to-cloud native mobile development, using Xamarin for Visual Studio, ASP.NET Core, and Azure. To learn more, please read Miguel de Icaza’s blog post introducing Visual Studio for Mac.


Visual Studio Mobile Center

is “mission control for mobile apps.” It brings together multiple services commonly used by mobile developers into a single, integrated service that allows you to build, test, deploy, and monitor cloud attached apps in one place. To learn more, please read Nat Friedman’s post elaborating on Visual Studio Mobile Center.


OK, let’s talk about the new feature support for C# & VB in VS2017.

IDE Experience and Productivity

Visual Studio provides new refactorings to allow you to organize source code with one action:

  • New in RC Simplify object initialization with an initializer:
  • New in RC Move out variable declarations inline, leveraging a new C#7 feature:
  • New in RC Simplify null checks and throw expressions using null-coalescing operator, leveraging a new C#7 feature:
  • Move type to matching file: Extract a type from one file and put it in another file with a matching name with one click via Ctrl+..
  • Sync file and type name: If your file and type name are out of sync, you can use Ctrl+..
  • Convert String.Format to string interpolation: take advantage of the C# 6 language feature with this Quick Action.

This release also introduces improvements to IntelliSense that will make you more productive when working in a large solution or an unfamiliar codebase. We have added an icon tray to IntelliSense that enables you to filter the member list by type (e.g., methods, properties, classes, etc.). Each filter toggle has an associated keyboard shortcut which you can discover by hovering over the icon. To enable this feature, go to Tools > Options > Text Editor > [C# | Visual Basic] > IntelliSense and check the options for filtering and highlighting.

We’ve also added/updated style analyzers to help you customize and enforce coding conventions on your team, including:

  • Naming style rules.
  • Use of “var” or explicit types.
  • Use of “this.” or “Me.” on member access.
  • Missing braces.
  • Missing switch case.

New in RC Building on Visual Studio’s support for EditorConfig, we worked with the community to add .NET code style settings to the file format. This means that you can configure your team’s code style conventions, check them into source control, and have violations appear live in the editor as developers are typing. You can see all the code style options in the Roslyn repo’s .editorconfig or in the documentation.

Other new features in this release include:

  • You can now split a long string into multiple concatenated strings by positioning the cursor mid-string and pressing Enter.
  • A new code action for converting a property to a method.
  • We now use fuzzy matching in the NavigateTo search results.

Look for the following improvements to the IDE experience that are also in Visual Studio 2015 Updates:

  • A new quick fix option to add a reference to a NuGet package.
  • Refactorings that simplify delegate invocations and raising events using the null condition operator.
  • Refactorings to make async methods synchronous where applicable.
  • Improvements to Add Using command to support “fuzzy” matching for misspelled types, including adding any needed project or metadata references.

Language Extensions and Analyzers

This release includes some proposed new language extensions that we are working on for the next versions of C# and Visual Basic. These new language features are enabled by default and include:

For C#:

  • Task-like return types for async methods: This introduces the ability to return any task-like type from an async method. Previously these return types were constrained to Task<T> and Task.
  • Value tuples introduce language support for using tuples to temporarily group a set of typed values. To learn more, please review the design notes on GitHub.
  • Nested local functions extend the language to support declaration of functions in a block scope.
  • Pattern matching extensions enable many of the benefits of algebraic data types and pattern matching from functional languages.
  • Ref returns enable functions to return values by reference.

For Visual Basic:

  • Value tuples introduce language support for using tuples to temporarily group a set of typed values: Dim point As (x As Integer, y As Integer) = GetOffset().
  • ByRef return consumption extend the language to support consumption of functions and properties from libraries which have ByRef returns.
  • Binary literals and digit group separators allow native representation of binary numbers. This is super convenient for bitmasks and flags enumerations: &B1001_0011.

For more information, follow our development on GitHub to learn more about these and other proposed language extensions and APIs.

Finally, we have done considerable work to improve responsiveness of the IDE in presence of background operations that compute diagnostics and CodeLens information.

DataBinding in second, third…TabPages

I have experience in few months ago. I was working on a WinForm application. I placed a TabControl with multiple TabPages. However, I found out that the dataBinding does not work on the second, third or later TabPage controls. After getting some error and test. I found out that the controls in these tabPage are not being loaded until it is “showed”.


So I have some code sample to resolve this, you may try to place it under Page.Load event handling,

    foreach (TabPage tp in tabControl1.TabPages)
    this.tabControl1.SelectedTab = this.tabPage2;


// here I am going to make sure that the dataBinding is completed before select into other tabPages.
// You may try to loop this one by one tabPage if you have more tabPages
    this.tabPage2.BindingContextChanged += (object sender, EventArgs e) => {
        this.tabControl1.SelectedTab = this.tabPage1;

    this.tabControl1.SelectedTab = this.tabPage1;

Hope this article could help you a bit.



New Feature for C# in VS2013? Nope.

As one of my previous blog “The new features introduced in each version for C# (1.0 – 5.0)“, I promised that I will come back to this when VS2013 is released. This time I come with more information about them.

.NET Framework versions

There have been seven significant releases of the .NET Framework, excluding service packs. The framework includes the compilers, runtime, and libraries. Additionally, there are other profiles such Silverlight which complicate matters.

  • 1.0 – released in 2002
  • 1.1 – released in 2003
  • 2.0 – released in 2005, with a new CLR (to handle generics and nullable types) and compilers for C# 2 and VB 8.
  • 3.0 – released in 2006, this is just 2.0 plus new libraries: Windows Presentation Foundation, Windows Communication Foundation, Workflow Foundation, and Cardspace
  • 3.5 – released in 2007, this is 3.0 plus new libraries (primarily LINQ and some extra “base” libraries such as TimeZoneInfo) and new compilers (for C# 3 and VB 9)
  • 4 – released in 2010, this includes a new CLR (v4), new libraries, and the DLR (Dynamic Language Runtime)
  • 4.5 – released in 2012, this allows for WinRT development on Windows 8 as well as extra libraries – with much wider async APIs

C# language versions

There are five significant language versions:

  • C# 1
  • C# 2, introducing generics, nullable types, anonymous methods, iterator blocks and some other more minor features
  • C# 3, introducing implicit typing, object and collection initializers, anonymous types, automatic properties, lambda expressions, extension methods, query expressions and some other minor features
  • C# 4, introducing dynamic typing, optional parameters, named arguments, and generic variance
  • C# 5, introducing asynchronous functions, caller info attributes, and a tweak to foreach iteration variable capture

See the specifications page for downloads for each version, from Microsoft and ECMA.

Visual Studio versions

For a long time, releases of Visual Studio were closely tied to framework releases. The picture has become a bit more flexible and complicated, however:

  • VS.NET 2002 – support for C# 1 and .NET 1.0
  • VS.NET 2003 – support for C# 1 and .NET 1.1
  • VS 2005 – support for C# 2 and .NET 2.0, and .NET 3.0 with an extension
  • VS 2008 – support for C# 3 and .NET 2.0, 3.0 and 3.5 (multi-targeting)
  • VS 2010 – support for C# 4 and .NET 2.0, 3.0, 3.5 and 4
  • VS 2012 – support for C# 5 and .NET 2.0 to 4.5 (including WinRT on Windows 8), and portable class libraries

That’s all the theory. Here are the practical limitations and working configurations. Note that this assumes you want to use Visual Studio – if you’re happy to use just the command line compiler, that’s a slightly different story which I’ll avoid for simplicity’s sake. (At some point I’ll return to this page to talk about C# 4 and C# 5 features, but not just now…)

  • You can’t use C# 2 features without at least VS 2005
  • You can’t use C# 3 features without VS 2008
  • You can’t ask VS 2005 or VS 2008 to target .NET 1.0 or 1.1 (there’s an extension for it, but I haven’t used it – expect some pain for debugging etc)
  • You can’t force VS 2008 to restrict you to only C# 2 features, or force VS 2005 to restrict you to C# 1 features
  • Each version of Visual Studio has its own project file format and will upgrade your older projects when you first load them in that version. (The differences between VS 2003 and VS 2005 were significant; the differences between VS 2005 and VS 2008 are much smaller.)
  • VS 2008 has special support (in project properties) for which framework version you want to target: 2.0, 3.0 or 3.5
  • You can use most C# 3 features when targeting .NET 2.0 or 3.0, but not quite all
Evolution of C# in vs2013
Evolution of C# in vs2013

You may found that there is no update on C# in VS2013. Yes, this is correct.

From the MSDN Developer Blog,
No new C# and VB Language Features in VS 2013

From the MSDN Library
What’s New in Visual Studio 2013

You may also have a look on the MSDN page for more information
.NET Framework Versions and Dependencies