C# 6.0 Support in Visual Studio 2012

Yes, you can install c# 6.0 into VS2012 and VS2013 on a per project basis as a NuGet package. You’ll have to install this package for every project that you want c# 6.0 features in. https://www.nuget.org/packages/Microsoft.Net.Compilers/ Installing Latest C# Compiler via Nuget Install-Package Microsoft.Net.Compilers EDIT: As pointed out in the comments below, upgrade your NuGet … Read more

Error CS1056: Unexpected character ‘$’ running the msbuild on a tfs continuous integration process

The problem can be fixed installing a Nuget package Microsoft.Net.Compilers. Below is the link of my highlighted answer: Project builds fine with Visual Studio but fails from the command line That feature is a syntactic sugar for C#6, try to install the latest version of the framework 4.6.2 https://www.microsoft.com/en-us/download/details.aspx?id=53345 Then go to your Project properties … Read more

How to use C# 6 with Web Site project type?

I’ve tested this with ASP.NET MVC 5 (tested 5.2.3), and your mileage may vary with other web frameworks, but you just need to add the NuGet package for Roslyn CodeDOM. Microsoft.CodeDom.Providers.DotNetCompilerPlatform should add the DLL files… PM> Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform Replacement CodeDOM providers that use the new .NET Compiler Platform (“Roslyn”) compiler as a service APIs. … Read more

How to implement INotifyPropertyChanged in C# 6.0?

After incorporating the various changes, the code will look like this. I’ve highlighted with comments the parts that changed and how each one helps public class Data : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { //C# 6 null-safe operator. No need to check for event listeners //If there … Read more

C#6.0 string interpolation localization

An interpolated string evaluates the block between the curly braces as a C# expression (e.g. {expression}, {1 + 1}, {person.FirstName}). This means that the expressions in an interpolated string must reference names in the current context. For example this statement will not compile: var nameFormat = $”My name is {name}”; // Cannot use *name* // … Read more

Automated property with getter only, can be set, why?

This is a new C# 6 feature, “Getter-only auto-properties”, also known as “Auto-Property Initializers for Read-Only Properties” as discussed in this MSDN magazine article ‘C# : The New and Improved C# 6.0’ by Mark Michaelis and in the C# 6.0 draft Language Specification. The read-only field’s setter is only accessible in the constructor, in all … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)