How to convert this string to vb.net

from a free order book for asp.net MVC

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, FormCollection formValues) {
    Dinner dinner = dinnerRepository.GetDinner(id);
    UpdateModel(dinner);
    dinnerRepository.Save();
    return RedirectToAction("Details", new { id = dinner.DinnerID });
}

how to convert this string to vb.net?

return RedirectToAction("Details", new { id = dinner.DinnerID });

more new {id = dinner.DinnerID} part

thanks

+3
source share
4 answers

try it

Return RedirectToAction("Details", New With { .id = dinner.DinnerID})

In VB, the syntax of an anonymous type declaration, as well as the initializers of normal objects, needs "." prefix for all property names. This is consistent with other VB features, such as the With context.

+9
source

This uses an anonymous type , so it will look like this:

Return RedirectToAction("Details", New With { .id = dinner.DinnerID })
+2
source

:

Return RedirectToAction("Details", New With { .id = dinner.DinnerID })
+1
New With {.id = dinner.DinnerID}
0

Source: https://habr.com/ru/post/1708272/


All Articles