I created a new Web Application using Visual Studio 2015 RTM and choose MVC template for it.
it created me a bunch of code there including a controller named AccountController
containing a method exactly like this:
<AllowAnonymous>
Public Function Login(returnUrl As String) As ActionResult
ViewData!ReturnUrl = returnUrl
Return View()
End Function
What the !
symbol does there? is it a part of vb.net syntax?
It's the exclamation point operator. See section "Exclamation Point (!) Operator" in Special Characters in Code (Visual Basic):
Use the
!
operator only on a class or interface as a dictionary access operator. The class or interface must have a default property that accepts a singleString
argument. The identifier immediately following the!
operator becomes the argument value passed to the default property as a string.
So, instead of doing:
ViewData("ReturnUrl") = returnUrl
You can do:
ViewData!ReturnUrl = returnUrl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With