I am running a .NET 4.5 project in VS 2013. Why is the following code an error?
var w = Request.Properties["MS_HttpContext"] as System.Web.HttpContextWrapper; string IP = w?.Request.UserHostAddress; //fail to compile
I found this code on this MSDN blog .
This is a new feature, available only in a future version of C #: C # 6. It is called an operator carrying a null operator with a null condition .
To use C # 6, you must download Visual Studio 2015 CTP , as the extension for Visual Studio 2013 is no longer supported (see here ).