c# - Visual Studio 2017 15.3 Simplifying null check -


i have code:

public unityresolver(iunitycontainer container) {    if (container == null) throw new argumentnullexception("container");    _container = container; } 

visual studio shows 3 grey dots , suggests simplify null check.

it makes method this:

_container = container ?? throw new argumentnullexception("container"); 

that don't build...

what's going on here? why think can simplify , why simplifying doesn't build.

the error gives is:

1>l:\sl1-(sentilan)-sentilan v1 - current system\sentilancore\web api plugins\apitest2\app_start\unityconfig.cs(31,39,31,44): error cs1525: invalid expression term 'throw' 1>l:\sl1-(sentilan)-sentilan v1 - current system\sentilancore\web api plugins\apitest2\app_start\unityconfig.cs(31,39,31,44): error cs1002: ; expected 

enter image description here

its compiler issue, code valid. updated version , fixed error in latest update(few hours ago). can download update if notification pops or website.

or update microsoft compiler version, since wasn't included in vs 2017...

install-package microsoft.net.compilers -version 2.3.0 latest think


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -