Enabling c# 7 in a asp.net application
In website’s NuGet window: Uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform Re-install it In web.config, under: system.codedom > compilers > compiler, change compilerOptions=”/langversion:6 to 7
In website’s NuGet window: Uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform Re-install it In web.config, under: system.codedom > compilers > compiler, change compilerOptions=”/langversion:6 to 7
This was explained by Mads Torgersen in C# Design Meeting Notes where local functions were first discussed: You want a helper function. You are only using it from within a single function, and it likely uses variables and type parameters that are in scope in that containing function. On the other hand, unlike a lambda … Read more
Update: The Roslyn compiler has been updated to make the behavior of the two operators the same when there is no overloaded equality operator. Please see the code in the current compiler results (M1 and M2 in the code) that shows what happens when there is no overloaded equality comparer. They both now have the … Read more
What are ValueTuples and why not Tuple instead? A ValueTuple is a struct which reflects a tuple, same as the original System.Tuple class. The main difference between Tuple and ValueTuple are: System.ValueTuple is a value type (struct), while System.Tuple is a reference type (class). This is meaningful when talking about allocations and GC pressure. System.ValueTuple … Read more
For .NET 4.6.2 or lower, .NET Core 1.x, and .NET Standard 1.x you need to install the NuGet package System.ValueTuple: Install-Package “System.ValueTuple” Or using a package reference in VS 2017: <PackageReference Include=”System.ValueTuple” Version=”4.4.0″ /> .NET Framework 4.7, .NET Core 2.0, and .NET Standard 2.0 include these types.
You can replace the compiler shipped with Visual Studio for a C# 7-enabled version by installing the Nuget package Microsoft.Net.Compilers: Referencing this package will cause the project to be built using the specific version of the C# and Visual Basic compilers contained in the package, as opposed to any system installed version. There is no … Read more